-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[logrotate] Enhance robustness #2942
Merged
Merged
Conversation
This file contains 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
…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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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
prerotate
script to delete all*.1.gz
files 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.prerotate
script tofirstaction
, asprerotate
is run after logrotate renames existing scripts, which is too late to delete all*.1.gz
files, as the renaming will fail andprerotate
will never be run.firstaction
runs before everything, so this is the appropriate script for all of this cleanup.service rsyslog rotate
no 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.gz
2.) 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