[logrotate] Enhance robustness#2942
Merged
lguohan merged 2 commits intosonic-net:masterfrom May 26, 2019
jleveque:logrotate_robustness
Merged
[logrotate] Enhance robustness#2942lguohan merged 2 commits intosonic-net:masterfrom jleveque:logrotate_robustness
lguohan merged 2 commits intosonic-net:masterfrom
jleveque:logrotate_robustness
Conversation
added 2 commits
May 23, 2019 23:23
…g logrotate processes
… init-system-helpers < 1.47 workaround However, continue to send SIGHUP directly to rsyslogd process because 'service rsyslog rotate' still doesn't work properly with init-system-helpers version 1.48
lguohan
approved these changes
May 24, 2019
Contributor
Author
|
Retest this please. |
MichelMoriniaux
pushed a commit
to criteo-forks/sonic-buildimage
that referenced
this pull request
May 28, 2019
* [logrotate] Decrease frequency to every 10 minutes; kill any lingering logrotate processes * [logrotate] Delete all *.1.gz files as firstaction; Remove note about init-system-helpers < 1.47 workaround However, continue to send SIGHUP directly to rsyslogd process because 'service rsyslog rotate' still doesn't work properly with init-system-helpers version 1.48
yxieca
pushed a commit
that referenced
this pull request
May 29, 2019
* [logrotate] Decrease frequency to every 10 minutes; kill any lingering logrotate processes * [logrotate] Delete all *.1.gz files as firstaction; Remove note about init-system-helpers < 1.47 workaround However, continue to send SIGHUP directly to rsyslogd process because 'service rsyslog rotate' still doesn't work properly with init-system-helpers version 1.48
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.
- What I did
- How I did it
prerotatescript to delete all*.1.gzfiles which, if they are present, means they were left over from a prior, incomplete run of logrotate. If any of these files exist, logrotate will fail to do its job for that log.prerotatescript tofirstaction, asprerotateis run after logrotate renames existing scripts, which is too late to delete all*.1.gzfiles, as the renaming will fail andprerotatewill never be run.firstactionruns before everything, so this is the appropriate script for all of this cleanup.service rsyslog rotateno longer reports an error, it doesn't seem to cause rsyslogd to properly close the old file. Therefore, we will continue sending SIGHUP directly to the rsyslogd process and no longer consider it a workaround.- How to verify it
1.) Simulate a left-behind *.1.gz file:
touch /var/log/syslog.1.gz2.) Fill syslog past the 1MB size threshold specified in the block
3.) Wait for 10 minutes (you can also tail /var/log/cron.log to watch for the next execution of logrotate), then check to ensure /var/log/syslog.1.gz is no longer present and that syslog has been rotated.
4.) Repeat with the other log files specified in this section