Skip to content
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

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

coderbirju
Copy link
Contributor

#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.

@coderbirju coderbirju marked this pull request as ready for review November 13, 2024 17:37
//maxSize Defaults to unlimited.
var capVal int64
capVal = -1
//maxSize Defaults to 100MB.
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Member

@djdongjin djdongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@djdongjin djdongjin added this to the v2.1.0 milestone Nov 18, 2024
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
Copy link
Member

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

@coderbirju
Copy link
Contributor Author

Could this fix be backported to nerdctl 1.7.x, considering containerd 2.0 is not yet LTS. @AkihiroSuda @djdongjin

Copy link
Member

@AkihiroSuda AkihiroSuda left a 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

@AkihiroSuda
Copy link
Member

LTS

For nerdctl we do not have any LTS (yet)

@AkihiroSuda AkihiroSuda merged commit 370b691 into containerd:main Nov 19, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants