feat: add ROX_LOGGING_TO_FILE to disable file logging#20019
Draft
feat: add ROX_LOGGING_TO_FILE to disable file logging#20019
Conversation
|
Skipping CI for Draft Pull Request. |
Contributor
🚀 Build Images ReadyImages are ready for commit 6a491e9. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-658-g6a491e93d3 |
04599bb to
7069b96
Compare
5f95e8d to
88f5846
Compare
Each logger that writes to a file spawns a lumberjack goroutine for log rotation. With ~30 loggers writing to /var/log/stackrox/log.txt, that's 30 idle goroutines + 30 independent file handles to the same file. In container environments, logs go to stdout and are collected by the container runtime — file logging is unnecessary overhead. Set ROX_LOGGING_TO_FILE=false to disable file logging, saving: - 30 goroutines and their stacks - File I/O overhead - lumberjack rotation processing Default is true (unchanged behavior) for backward compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
88f5846 to
6a491e9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #20019 +/- ##
==========================================
- Coverage 49.61% 49.61% -0.01%
==========================================
Files 2765 2765
Lines 208628 208650 +22
==========================================
+ Hits 103509 103513 +4
- Misses 97462 97479 +17
- Partials 7657 7658 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
ROX_LOGGING_TO_FILEenvironment variable (default:true) to control whether log output is written to files. When set tofalse, all file-based logging is disabled — only stdout/stderr output remains.In container environments where the container runtime captures stdout, file logging is redundant. Disabling it eliminates file handles, lumberjack goroutines, and disk I/O.
Changes
ROX_LOGGING_TO_FILEinpkg/env/logging.goaddOutput(&config, LoggingPath)when disabledtrue(backward compatible)Measurements
Depends on the zap sampling change (#19997, merged).
User-facing documentation
Testing and quality
Automated testing
How I validated my change
AI-assisted.