Skip to content

Commit a281bf0

Browse files
Making auth access logs optional (#10380)
Co-authored-by: Marcelo Cyreno <[email protected]>
1 parent fb80e6d commit a281bf0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

internal/ingress/controller/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ type Configuration struct {
120120
// By default this is disabled
121121
EnableAccessLogForDefaultBackend bool `json:"enable-access-log-for-default-backend"`
122122

123+
// EnableAuthAccessLog enable auth access log
124+
// By default this is disabled
125+
EnableAuthAccessLog bool `json:"enable-auth-access-log"`
126+
123127
// AccessLogPath sets the path of the access logs for both http and stream contexts if enabled
124128
// http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
125129
// http://nginx.org/en/docs/stream/ngx_stream_log_module.html#access_log
@@ -858,6 +862,7 @@ func NewDefault() Configuration {
858862
AccessLogPath: "/var/log/nginx/access.log",
859863
AccessLogParams: "",
860864
EnableAccessLogForDefaultBackend: false,
865+
EnableAuthAccessLog: false,
861866
WorkerCPUAffinity: "",
862867
ErrorLogPath: "/var/log/nginx/error.log",
863868
BlockCIDRs: defBlockEntity,

rootfs/etc/nginx/template/nginx.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,9 @@ stream {
11031103
opentelemetry_propagate;
11041104
{{ end }}
11051105

1106+
{{ if not $all.Cfg.EnableAuthAccessLog }}
11061107
access_log off;
1108+
{{ end }}
11071109

11081110
# Ensure that modsecurity will not run on an internal location as this is not accessible from outside
11091111
{{ if $all.Cfg.EnableModsecurity }}

0 commit comments

Comments
 (0)