Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/env/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ var (
// it gets rotated. It defaults to 20 megabytes.
LoggingMaxSizeMB = RegisterIntegerSetting("ROX_LOGGING_MAX_SIZE_MB", 20)
)

// LoggingToFile controls whether logs are written to a file in addition
// to stdout/stderr. Disabling reduces goroutine count (one per logger
// for log rotation) and file I/O. Container environments typically
// collect logs from stdout via the container runtime.
var LoggingToFile = RegisterBooleanSetting("ROX_LOGGING_TO_FILE", true)
4 changes: 3 additions & 1 deletion pkg/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ func init() {
// To the alert reader: While we could theoretically create a zapcore.Core instance and use
// the logFile to create a MultiSyncWriter, we stick with using the config-based approach
// such that we can easily propagate changes to log levels.
addOutput(&config, LoggingPath)
if env.LoggingToFile.BooleanSetting() {
addOutput(&config, LoggingPath)
}

if buildinfo.ReleaseBuild {
config.DisableStacktrace = true
Expand Down
Loading