Skip to content

Commit 71fa342

Browse files
committed
add warning and exclude stdout and stderr
1 parent 8eea4b8 commit 71fa342

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/watcher/instance/nginx_config_parser.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ func (ncp *NginxConfigParser) createNginxConfigContext(
129129
if !ncp.ignoreLog(directive.Args[0]) {
130130
errorLog := ncp.errorLog(directive.Args[0], ncp.errorLogDirectiveLevel(directive))
131131
nginxConfigContext.ErrorLogs = append(nginxConfigContext.ErrorLogs, errorLog)
132+
} else {
133+
slog.WarnContext(ctx, fmt.Sprintf("Error log outputs to %s. Unable to monitor logs during "+
134+
"config apply, log errors to file to enable error monitoring", directive.Args[0]),
135+
"error_log", directive.Args[0])
132136
}
133137
case "root":
134138
rootFiles := ncp.rootFiles(ctx, directive.Args[0])
@@ -185,7 +189,7 @@ func (ncp *NginxConfigParser) createNginxConfigContext(
185189

186190
func (ncp *NginxConfigParser) ignoreLog(logPath string) bool {
187191
logLower := strings.ToLower(logPath)
188-
ignoreLogs := []string{"off", "/dev/stderr", "/dev/stdout", "/dev/null"}
192+
ignoreLogs := []string{"off", "/dev/stderr", "/dev/stdout", "/dev/null", "stderr", "stdout"}
189193

190194
if strings.HasPrefix(logLower, "syslog:") || slices.Contains(ignoreLogs, logLower) {
191195
return true

0 commit comments

Comments
 (0)