Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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.
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.
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.