| Summary: | logrotate does not rotate certain log files | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Nikola Stiasni <nstiasni> |
| Component: | logrotate | Assignee: | Kamil Dudka <kdudka> |
| Status: | CLOSED CANTFIX | QA Contact: | qe-baseos-daemons |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | bjarolim, kdudka, kwalker, lpol, mklika, ondrej.valousek, vdanek, zpytela |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-06-17 12:39:44 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | |||
| Bug Blocks: | 1298243, 1398314, 1420851, 1451294 | ||
I took over this bugzilla and the support case which initiated it. Just managed to nail down the configuration to reproduce.
Let's have this /etc/logrotate.d/test logrotate configuration file:
/local/rsyslog/existing
/local/rsyslog/nonexist {
daily
rotate 2
create
nodateext
#missingok
#sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
The first file exist, the second one does not.
When logrotate is run (logrotate -vf /etc/logrotate.d/test), the files are rotated fine. Once the sharedscripts directive is uncommented, the commands output look fine at first glance, older logs are rotated, but the actual log is not; the command output misses these lines:
> fscreate context set to unconfined_u:object_r:default_t:s0
> renaming /local/rsyslog/existing to /local/rsyslog/existing.1
> creating new /local/rsyslog/existing mode = 0644 uid = 0 gid = 0
> running postrotate script
If missingok directive is uncommented as well, it works again. In the logrotate(8) manual page, the sharedscripts option is described as follows:
sharedscripts
Normally, prerotate and postrotate scripts are run for each log which is rotated
and the absolute path to the log file is passed as first argument to the script.
That means a single script may be run multiple times for log file entries which
match multiple files (such as the /var/log/news/* example). If sharedscripts is
specified, the scripts are only run once, no matter how many logs match the wild‐
carded pattern, and whole pattern is passed to them. However, if none of the
logs in the pattern require rotating, the scripts will not be run at all. If the
scripts exit with error, the remaining actions will not be executed for any logs.
This option overrides the nosharedscripts option and implies create option.
Seems just like misunderstanding now, or different interpretation how the rotation should work according to the options combination. The customer uses the configuration this way, and forces the rotation with -f switch. Could we have this clarified?
I agree this is a bug. See bug #1196583 comment #3 for the cause and the fix. The problem is that the fix caused another issue and has already been reverted upstream. Could the missingok option be used as a workaround for the customer? Hi Kamil, I was far from stating this being a logrotate bug; for me it was more like unclear documentation. It looks different now, thanks for the link. I asked our customer if he is satisfied with the workaround for now. Is there any reason for keeping this bug private? (In reply to Zdenek Pytela from comment #5) > I asked our customer if he is satisfied with the workaround for now. Thanks! The reason I am asking is that the fix in question introduces a change in behavior, which we try to avoid in RHEL, if possible, in order not to break existing solutions of our customers. > Is there any reason for keeping this bug private? Not that I know of. Currently, customer is satisfied with using the "missingok" option as a workaround, but he is interested in participation in this bugzilla and future development. I am making this bug public. This bug is unlikely to be fixed in RHEL-7 because the proposed fix implies a change in behavior, which could break existing installations of logrtate that rely on the current behavior. Note that the original fix for this bug has been already reverted upstream because it caused a regression in certain configurations. Please consider using the "missingok" directive to work around this bug. *** Bug 1667046 has been marked as a duplicate of this bug. *** Per comment #12 closing CANTFIX. |
Description of problem: Customer has the following configuration in /etc/logrotate.d/rsyslog: # Linux/Unix # /local/rsyslog/auth /local/rsyslog/kernel /local/rsyslog/news /local/rsyslog/cron /local/rsyslog/goldengate /local/rsyslog/mail /local/rsyslog/sftp_automatic /local/rsyslog/sftp /local/rsyslog/siem /local/rsyslog/rest { daily notifempty rotate 1500 create nodateext sharedscripts postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true endscript } # # Cluster-Mode NetApp # /local/rsyslog/f1fsp1 /local/rsyslog/f1fsp2 /local/rsyslog/f1fsp3 /local/rsyslog/f1fsp4 /local/rsyslog/f1fsnld1 /local/rsyslog/f1fsnld2 /local/rsyslog/deengfsn11 /local/rsyslog/deengfsn12 { daily notifempty compress rotate 1500 create nodateext sharedscripts postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true endscript } # # ESX servers # /local/rsyslog/sdrsappesxp /local/rsyslog/sdrsappesxz /local/rsyslog/sdrsdeesxp /local/rsyslog/sdrsspsesx /local/rsyslog/sdrspdfesxp /local/rsyslog/sdrsspsesxp /local/rsyslog/sdrsuxesxp /local/rsyslog/sdrsesxd /local/rsyslog/sdrsesxp /local/rsyslog/sdrsesxz /local/rsyslog/sdrsesxl /local/rsyslog/f1esxd /local/rsyslog/sfc1esx /local/rsyslog/sdrspeesx /local/rsyslog/saldesx /local/rsyslog/sdrsvcesx /local/rsyslog/sdrsvcesxl /local/rsyslog/sdrsvcesxp { daily notifempty compress rotate 30 create nodateext sharedscripts postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true endscript } These entries can be split into 3 files, however, this does not change the underlying issue. Customer claims that some files, for example "/local/rsyslog/sdrsappesxz", are not being rotated despite the message that file needs to be rotated. Older rotated files were all deleted by the customer, so logrotate kept producing the errors: renaming /local/rsyslog/sdrsappesxz.30.gz to /local/rsyslog/sdrsappesxz.31.gz (rotatecount 30, logstart 1, i 30), old log /local/rsyslog/sdrsappesxz.30.gz does not exist renaming /local/rsyslog/sdrsappesxz.29.gz to /local/rsyslog/sdrsappesxz.30.gz (rotatecount 30, logstart 1, i 29), old log /local/rsyslog/sdrsappesxz.29.gz does not exist By adding "missingok" to his config file, customer said that " adding "missingok" to my config (please see below) made logrotate rotate all files." However, he thinks there is a bug with logrotate: "I had so many _existing_ files that were not rotated by logrotate as configured (comparing to the description of "missingok") I still consider this a logrotate bug." Version-Release number of selected component (if applicable): logrotate-3.8.6-7.el7_2.x86_64 How reproducible: I could not reproduce his issue no matter what I did. I copied his config file to my RHEL 7 server and all logs kept rotating as expected.