-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: default json-file log size to 100MB #3670
Conversation
pkg/logging/json_logger.go
Outdated
//maxSize Defaults to unlimited. | ||
var capVal int64 | ||
capVal = -1 | ||
//maxSize Defaults to 100MB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this set to 100MiB?
How was this value chosen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100MB is the default value that go-logrotate specifies for each log file.
defaultMaxsize = 100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add that context to the code comment?
75c4c88
to
e97bfa8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
pkg/logging/json_logger.go
Outdated
capVal = -1 | ||
// MaxBytes is the maximum size in bytes of the log file before it gets | ||
// rotated. If not set, it defaults to 100 MiB. | ||
// see: https://github.com/fahedouch/go-logrotate/blob/main/logrotate.go#L500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"main" has to be replaced with an exact version or a commit hash for permanence
Signed-off-by: Arjun Raja Yogidas <[email protected]>
e97bfa8
to
1fdb4b0
Compare
Could this fix be backported to nerdctl 1.7.x, considering containerd 2.0 is not yet LTS. @AkihiroSuda @djdongjin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, feel free to open cherry-pick PR for v1.7
For nerdctl we do not have any LTS (yet) |
#3661
This commit makes the json-file logger to default logrotate maxBytes configuration of 100MB.
It is a temporary fix to a bug addressed by this logrotate PR.
Setting the default values in the config passed to logrotate fixes the issue temporarily but having unlimited size for container logs will be available when the issue is addressed upstream.
Testing done :
Verified that the logging mechanism works and appends the logs to the same log file and doesn't create a new log file.