-
Notifications
You must be signed in to change notification settings - Fork 40k
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 logrotate config on GCI #29139
Fix logrotate config on GCI #29139
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,12 +77,21 @@ function setup-logrotate() { | |
compress | ||
maxsize 10M | ||
daily | ||
dateext | ||
dateformat -%Y%m%d-%s | ||
create 0644 root root | ||
} | ||
EOF | ||
|
||
# Configuration for k8s services that redirect logs to /var/log/<service>.log | ||
# files. | ||
# files. Whenever logrotate is ran, this config will: | ||
# * rotate the log file if its size is > 100Mb OR if one day has elapsed | ||
# * save rotated logs into a gzipped timestamped backup | ||
# * log file timestamp (controlled by 'dateformat') includes seconds too. this | ||
# ensures that logrotate can generate unique logfiles during each rotation | ||
# (otherwise it skips rotation if 'maxsize' is reached multiple times in a | ||
# day). | ||
# * keep only 5 old (rotated) logs, and will discard older logs. | ||
local logrotate_files=( "kube-scheduler" "kube-proxy" "kube-apiserver" "kube-controller-manager" "kube-addons" ) | ||
for file in "${logrotate_files[@]}" ; do | ||
cat > /etc/logrotate.d/${file} <<EOF | ||
|
@@ -92,8 +101,10 @@ EOF | |
missingok | ||
notifempty | ||
compress | ||
size 100M | ||
maxsize 100M | ||
daily | ||
dateext | ||
dateformat -%Y%m%d-%s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a comment about the significance (i.e collisions, and that exceeding maxsize within a second will not rotate). A meta comment about how we expect logorate to happen will also help, something like: "logrotate daily or if the size exceeds maxsize, into a gzipped timestamped backup. Backups are discarded after ." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we going backwards on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. From my testing, this is the only combination (maxsize with dateformat) that gives us expected behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. So this will stamp out >100M files every 1h on busy clusters? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I tried explain a bit in the comment. PTAL. |
||
create 0644 root root | ||
} | ||
EOF | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,10 @@ | |
missingok | ||
notifempty | ||
compress | ||
size 100M | ||
maxsize 100M | ||
daily | ||
dateext | ||
dateformat -%Y%m%d-%s | ||
create 0644 root root | ||
} | ||
|
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.
I would like to bring this to your attention @zmerlynn @bprashanth . The 10M size for docker-container log seems arbitrary too. But I guess we don't encourage users to log to stdout/stderr from their containers. So this may not be an issue.
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.
I thought stdout/stderr was the default way fluentd picked up the container logs?
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.
Nevermind. I recalled some discussion on google-containers group recommending to redirect logs to files.
So, is 10Mb here fine?