Skip to content

Commit

Permalink
Ability to separately disable access log in http and stream contexts
Browse files Browse the repository at this point in the history
Two new configuration options:
`disable-http-access-log`
`disable-stream-access-log`

Should resolve issue with enormous amount of `TCP 200` useless entries in logs

Signed-off-by: Andrey Voronkov <voronkovaa@gmail.com>
  • Loading branch information
Antiarchitect committed May 13, 2020
1 parent 46cca5a commit bced1ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions internal/ingress/controller/config/config.go
Expand Up @@ -157,10 +157,19 @@ type Configuration struct {
// http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout
ClientBodyTimeout int `json:"client-body-timeout,omitempty"`

// DisableAccessLog disables the Access Log globally from NGINX ingress controller
//http://nginx.org/en/docs/http/ngx_http_log_module.html
// DisableAccessLog disables the Access Log globally for both HTTP and Stream contexts from NGINX ingress controller
// http://nginx.org/en/docs/http/ngx_http_log_module.html
// http://nginx.org/en/docs/stream/ngx_stream_log_module.html
DisableAccessLog bool `json:"disable-access-log,omitempty"`

// DisableHTTPAccessLog disables the Access Log for http context globally from NGINX ingress controller
// http://nginx.org/en/docs/http/ngx_http_log_module.html
DisableHTTPAccessLog bool `json:"disable-http-access-log,omitempty"`

// DisableStreamAccessLog disables the Access Log for stream context globally from NGINX ingress controller
// http://nginx.org/en/docs/stream/ngx_stream_log_module.html
DisableStreamAccessLog bool `json:"disable-stream-access-log,omitempty"`

// DisableIpv6DNS disables IPv6 for nginx resolver
DisableIpv6DNS bool `json:"disable-ipv6-dns"`

Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/nginx/template/nginx.tmpl
Expand Up @@ -315,7 +315,7 @@ http {
default 1;
}

{{ if $cfg.DisableAccessLog }}
{{ if or $cfg.DisableAccessLog $cfg.DisableHTTPAccessLog }}
access_log off;
{{ else }}
{{ if $cfg.EnableSyslog }}
Expand Down Expand Up @@ -684,7 +684,7 @@ stream {

log_format log_stream '{{ $cfg.LogFormatStream }}';

{{ if $cfg.DisableAccessLog }}
{{ if or $cfg.DisableAccessLog $cfg.DisableStreamAccessLog }}
access_log off;
{{ else }}
access_log {{ $cfg.AccessLogPath }} log_stream {{ $cfg.AccessLogParams }};
Expand Down

0 comments on commit bced1ed

Please sign in to comment.