Bug 57388
Summary: | Need option like sharedscripts but that runs only if at least one log is rotated. | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | John Dalbec <jpdalbec> |
Component: | logrotate | Assignee: | Elliot Lee <sopwith> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Aaron Brown <abrown> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.1 | Keywords: | FutureFeature |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2004-06-28 17:20:48 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
John Dalbec
2001-12-11 14:58:07 UTC
Sounds like a nice idea. Unfortunately, since logrotate is at the bottom of the food chain, I'm not likely to be able to implement it in this lifetime. "Patches welcome", or something - perhaps asking on redhat-devel-list might find a volunteer to write the patch. Apparently a common desire for logrotate is to have a bunch of log files that one wishes to rotate (e.g., from syslogd), but only SIGHUP syslogd when one or more files need rotating. I offer the following scripts (as part of a logrotate config file) that not only do the job, but allow custom processing of some of syslogd's files without SIGHUPing syslogd multiple times. This uses an undocumented feature of logrotate to pass the rotated file name to the script as the first ($1) parameter; /var/log/syslog/*.log { prerotate echo $1 >>/var/state/logrotate/syslog endscript } /var/state/logrotate/syslog { daily # MUST be daily, as logs can rotate any day of the week rotate 1 # (or zero, or any other number) notifempty # This is the key to only running if rotation occurred. prerotate /bin/killall -HUP syslogd for f in `cat $1`; do case $f in /var/log/syslog/kernel.log) # special stuff to parse kernel.log.1 (AKA $f.1) here ... ;; esac done endscript } Does logrotate always process logs in the order listed? In what order are the /etc/logrotate.d files processed? Logrotate processes logrotate config files in the order it finds them in the /etc/logrotate.d directory (which can appear random), but within a lorotate config file, the actions are processed in order of specification (according to my reading of the code, my experience, and the assurance of ewt @redhat.com -- the original author of logrotate). Send patches |