Add support for access-log-path
This commit is contained in:
parent
e7d2ff6fac
commit
9049b9308e
4 changed files with 14 additions and 3 deletions
|
@ -182,7 +182,7 @@ the whole body or only its part is written to a temporary file. By default, buff
|
||||||
This is 8K on x86, other 32-bit platforms, and x86-64. It is usually 16K on other 64-bit platforms. This annotation is
|
This is 8K on x86, other 32-bit platforms, and x86-64. It is usually 16K on other 64-bit platforms. This annotation is
|
||||||
applied to each location provided in the ingress rule.
|
applied to each location provided in the ingress rule.
|
||||||
|
|
||||||
*Note:* The annotation value must be given in a valid format otherwise the
|
*Note:* The annotation value must be given in a valid format otherwise the
|
||||||
For example to set the client-body-buffer-size the following can be done:
|
For example to set the client-body-buffer-size the following can be done:
|
||||||
* `ingress.kubernetes.io/client-body-buffer-size: "1000"` # 1000 bytes
|
* `ingress.kubernetes.io/client-body-buffer-size: "1000"` # 1000 bytes
|
||||||
* `ingress.kubernetes.io/client-body-buffer-size: 1k` # 1 kilobyte
|
* `ingress.kubernetes.io/client-body-buffer-size: 1k` # 1 kilobyte
|
||||||
|
@ -311,6 +311,8 @@ Example usage: `custom-http-errors: 404,415`
|
||||||
|
|
||||||
**disable-access-log:** Disables the Access Log from the entire Ingress Controller. This is 'false' by default.
|
**disable-access-log:** Disables the Access Log from the entire Ingress Controller. This is 'false' by default.
|
||||||
|
|
||||||
|
**access-log-path:** Access log path. Goes to '/var/log/access.log' by default. http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
|
||||||
|
|
||||||
**disable-ipv6:** Disable listening on IPV6. This is 'false' by default.
|
**disable-ipv6:** Disable listening on IPV6. This is 'false' by default.
|
||||||
|
|
||||||
**enable-dynamic-tls-records:** Enables dynamically sized TLS records to improve time-to-first-byte. Enabled by default. See [CloudFlare's blog](https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency) for more information.
|
**enable-dynamic-tls-records:** Enables dynamically sized TLS records to improve time-to-first-byte. Enabled by default. See [CloudFlare's blog](https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency) for more information.
|
||||||
|
@ -486,6 +488,7 @@ The following table shows the options, the default value and a description.
|
||||||
|keep-alive|"75"|
|
|keep-alive|"75"|
|
||||||
|log-format-stream|[$time_local] $protocol $status $bytes_sent $bytes_received $session_time|
|
|log-format-stream|[$time_local] $protocol $status $bytes_sent $bytes_received $session_time|
|
||||||
|log-format-upstream|[$the_real_ip] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status|
|
|log-format-upstream|[$the_real_ip] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status|
|
||||||
|
|access-format-stream|[$time_local] $protocol $status $bytes_sent $bytes_received $session_time|
|
||||||
|map-hash-bucket-size|"64"|
|
|map-hash-bucket-size|"64"|
|
||||||
|max-worker-connections|"16384"|
|
|max-worker-connections|"16384"|
|
||||||
|proxy-body-size|same as body-size|
|
|proxy-body-size|same as body-size|
|
||||||
|
|
|
@ -92,6 +92,11 @@ type Configuration struct {
|
||||||
// By default this is disabled
|
// By default this is disabled
|
||||||
AllowBackendServerHeader bool `json:"allow-backend-server-header"`
|
AllowBackendServerHeader bool `json:"allow-backend-server-header"`
|
||||||
|
|
||||||
|
// AccessLogPath set the path of the access logs if enabled
|
||||||
|
// http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
|
||||||
|
// By default log go to /var/log/nginx/access.log
|
||||||
|
AccessLogPath string `json:"access-log-path,omitempty"`
|
||||||
|
|
||||||
// EnableDynamicTLSRecords enables dynamic TLS record sizes
|
// EnableDynamicTLSRecords enables dynamic TLS record sizes
|
||||||
// https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency
|
// https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency
|
||||||
// By default this is enabled
|
// By default this is enabled
|
||||||
|
@ -340,6 +345,7 @@ func NewDefault() Configuration {
|
||||||
defIPCIDR = append(defIPCIDR, "0.0.0.0/0")
|
defIPCIDR = append(defIPCIDR, "0.0.0.0/0")
|
||||||
cfg := Configuration{
|
cfg := Configuration{
|
||||||
AllowBackendServerHeader: false,
|
AllowBackendServerHeader: false,
|
||||||
|
AccessLogPath: "/var/log/nginx/access.log",
|
||||||
ClientHeaderBufferSize: "1k",
|
ClientHeaderBufferSize: "1k",
|
||||||
ClientHeaderTimeout: 60,
|
ClientHeaderTimeout: 60,
|
||||||
ClientBodyBufferSize: "8k",
|
ClientBodyBufferSize: "8k",
|
||||||
|
|
|
@ -39,6 +39,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
|
||||||
"skip-access-log-urls": "/log,/demo,/test",
|
"skip-access-log-urls": "/log,/demo,/test",
|
||||||
"use-proxy-protocol": "true",
|
"use-proxy-protocol": "true",
|
||||||
"disable-access-log": "true",
|
"disable-access-log": "true",
|
||||||
|
"access-log-path": "/var/log/test",
|
||||||
"use-gzip": "true",
|
"use-gzip": "true",
|
||||||
"enable-dynamic-tls-records": "false",
|
"enable-dynamic-tls-records": "false",
|
||||||
"gzip-types": "text/html",
|
"gzip-types": "text/html",
|
||||||
|
@ -47,6 +48,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
|
||||||
def := config.NewDefault()
|
def := config.NewDefault()
|
||||||
def.CustomHTTPErrors = []int{300, 400}
|
def.CustomHTTPErrors = []int{300, 400}
|
||||||
def.DisableAccessLog = true
|
def.DisableAccessLog = true
|
||||||
|
def.AccessLogPath = "/var/log/test"
|
||||||
def.SkipAccessLogURLs = []string{"/log", "/demo", "/test"}
|
def.SkipAccessLogURLs = []string{"/log", "/demo", "/test"}
|
||||||
def.ProxyReadTimeout = 1
|
def.ProxyReadTimeout = 1
|
||||||
def.ProxySendTimeout = 2
|
def.ProxySendTimeout = 2
|
||||||
|
|
|
@ -118,7 +118,7 @@ http {
|
||||||
{{ if $cfg.DisableAccessLog }}
|
{{ if $cfg.DisableAccessLog }}
|
||||||
access_log off;
|
access_log off;
|
||||||
{{ else }}
|
{{ else }}
|
||||||
access_log /var/log/nginx/access.log upstreaminfo if=$loggable;
|
access_log {{ $cfg.AccessLogPath }} upstreaminfo if=$loggable;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
error_log /var/log/nginx/error.log {{ $cfg.ErrorLogLevel }};
|
error_log /var/log/nginx/error.log {{ $cfg.ErrorLogLevel }};
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ stream {
|
||||||
{{ if $cfg.DisableAccessLog }}
|
{{ if $cfg.DisableAccessLog }}
|
||||||
access_log off;
|
access_log off;
|
||||||
{{ else }}
|
{{ else }}
|
||||||
access_log /var/log/nginx/access.log log_stream;
|
access_log {{ $cfg.AccessLogPath }} log_stream;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
error_log /var/log/nginx/error.log;
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
Loading…
Reference in a new issue