-
Notifications
You must be signed in to change notification settings - Fork 949
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
feature: add support for maximum log size and max number of log files #2262
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2262 +/- ##
==========================================
- Coverage 66.8% 66.61% -0.19%
==========================================
Files 208 208
Lines 16934 16986 +52
==========================================
+ Hits 11312 11316 +4
- Misses 4260 4301 +41
- Partials 1362 1369 +7
|
daemon/logger/jsonfile/jsonfile.go
Outdated
return &JSONLogFile{ | ||
f: f, | ||
perms: perms, | ||
closed: false, |
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.
Do we need to add more filed here as https://docs.docker.com/config/containers/logging/json-file/#options, and add a validate func to check in case other filed can't work but appeared in pouch inspect?
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.
Yes. Now pouch's log options is not implemented completely. More filed should be supported in the future, but in other independent patches, I think.
validate check function is necessary, too. Should it be also treated as another issue to fix ?
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.
ok LGTM
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.
please remove the submodule
basically, it look good to me, but if we merge this, the @zjumoon01 would you add one more issue to track this? thanks |
ping @zjumoon01 |
Signed-off-by: Wangrui [email protected]
Ⅰ. Describe what this PR did
Add two flags max-size and max-file followed by --log-opt to support container log rotate.
Only support jsonfile driver.
Add max-size and max-file flags followed by --log-opt in pouchd.
Example:
This will rotate container log when its size exceeds 100Mb, and it is saved in 5 log files at most.
Note that max-size and max-file flags are only supported in jsonfile driver.
Ⅱ. Does this pull request fix one issue?
fixes #2177
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Now some test cases are done manually.
Test code is absent. It's welcome and a "TODO" work.
Ⅳ. Describe how to verify it
step1. launch pouchd with max-size and max-file flags
step2. run a container which could write stdout to its log
step3. check container log is rotated
Ⅴ. Special notes for reviews