Skip to content

Commit ac382ed

Browse files
TuTuRyYEajaumetnschad
authored
add nginx access log toggle (#402)
* add nginx access log toggle Signed-off-by: ajaumet <ajaumet@scaleway.com> * Update templates/nginx/nginx-config.yaml Co-authored-by: Niclas Schad <niclas.schad@gmail.com> Signed-off-by: ajaumet <ajaumet@scaleway.com> * update CHANGELOG.md Signed-off-by: ajaumet <ajaumet@scaleway.com> * fix the values reference in nginx config Signed-off-by: ajaumet <ajaumet@scaleway.com> Signed-off-by: ajaumet <ajaumet@scaleway.com> Co-authored-by: ajaumet <ajaumet@scaleway.com> Co-authored-by: Niclas Schad <niclas.schad@gmail.com>
1 parent e2de2f1 commit ac382ed

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## master / unreleased
44

5+
* [ENHANCEMENT] Add verboseLogging option to nginx config #402
56
* [DEPENDENCY] Update quay.io/cortexproject/cortex Docker tag to v1.13.1 #401
67
* [ENHANCEMENT] Add pod topology spread constrant option to Ingester/Alertmanager statefulset #403
78

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ Kubernetes: `^1.19.0-0`
494494
| nginx.&ZeroWidthSpace;config.&ZeroWidthSpace;mainSnippet | string | `""` | arbitrary snippet to inject in the top section of the nginx config |
495495
| nginx.&ZeroWidthSpace;config.&ZeroWidthSpace;serverSnippet | string | `""` | arbitrary snippet to inject in the server { } section of the nginx config |
496496
| nginx.&ZeroWidthSpace;config.&ZeroWidthSpace;setHeaders | object | `{}` | |
497+
| nginx.&ZeroWidthSpace;config.&ZeroWidthSpace;verboseLogging | bool | `true` | Enables all access logs from nginx, otherwise ignores 2XX and 3XX status codes |
497498
| nginx.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;enabled | bool | `true` | |
498499
| nginx.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;readOnlyRootFilesystem | bool | `false` | |
499500
| nginx.&ZeroWidthSpace;enabled | bool | `true` | |

templates/nginx/nginx-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ data:
2828
log_format main '$remote_addr - $remote_user [$time_local] $status '
2929
'"$request" $body_bytes_sent "$http_referer" '
3030
'"$http_user_agent" "$http_x_forwarded_for" $http_x_scope_orgid';
31+
32+
{{- if .Values.nginx.config.verboseLogging }}
3133
access_log /dev/stderr main;
34+
{{- else }}
35+
map $status $loggable {
36+
~^[23] 0;
37+
default 1;
38+
}
39+
access_log /dev/stderr main if=$loggable;
40+
{{- end }}
41+
3242
sendfile on;
3343
tcp_nopush on;
3444
resolver {{ default (printf "kube-dns.kube-system.svc.%s" .Values.clusterDomain ) .Values.nginx.config.dnsResolver }}{{- if .Values.nginx.config.dnsTTL }} valid={{ .Values.nginx.config.dnsTTL }}{{- end }};

values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,8 @@ nginx:
12781278
basicAuthSecretName: ""
12791279
# -- Including the valid parameter to the `resolver` directive to re-resolve names every `dnsTTL` seconds/minutes
12801280
dnsTTL: "15s"
1281+
# -- Enables all access logs from nginx, otherwise ignores 2XX and 3XX status codes
1282+
verboseLogging: true
12811283
image:
12821284
repository: nginx
12831285
tag: 1.23

0 commit comments

Comments
 (0)