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.
Bug 1510046 - logrotate weekly rotation is inconsistent and unpredictable
Summary: logrotate weekly rotation is inconsistent and unpredictable
Keywords:
Status: CLOSED DUPLICATE of bug 1465720
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: logrotate
Version: 7.4
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-06 15:27 UTC by Gilles Detillieux
Modified: 2017-11-07 13:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-11-07 13:21:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Debian BTS 825776 0 None None None 2017-11-06 15:27:02 UTC

Description Gilles Detillieux 2017-11-06 15:27:03 UTC
Description of problem:
logrotate won't do weekly rotation if last week's rotation was even 1 second later than this week's rotation. This is nearly impossible to do consistently, even if running logrotate directly from a crontab entry, and certainly impossible when run from /etc/cron.daily/logrotate as it is by default. The result is that weekly rotations which should occur on Sunday often don't happen until Monday morning. A hook in logrotate seems to reset things so that after a Monday rotation, the next one occurs on Sunday (weekday comparison in addition to time comparison).

Version-Release number of selected component (if applicable):
3.8.6-14

How reproducible:
Happens quite frequently.

Steps to Reproduce:
1. Wait for logrotate to run Sunday morning, then check later that day or the next.
2. ls -ltr /var/log/messages*
3. Look at the dates of the rotated log files.
4. Note that they're not always 7 days apart - some are on Monday rather than Sunday

Actual results:
-rw-------. 1 root root 20645073 Oct 16 04:18 /var/log/messages-20171016
-rw-------. 1 root root 17065169 Oct 22 04:17 /var/log/messages-20171022
-rw-------. 1 root root 15279183 Oct 29 07:45 /var/log/messages-20171029
-rw-------. 1 root root 14792166 Nov  6 04:44 /var/log/messages-20171106
-rw-------. 1 root root   325138 Nov  6 08:52 /var/log/messages

Expected results:
-rw-------. 1 root root 20645073 Oct 15 04:18 /var/log/messages-20171015
-rw-------. 1 root root 17065169 Oct 22 04:17 /var/log/messages-20171022
-rw-------. 1 root root 15279183 Oct 29 07:45 /var/log/messages-20171029
-rw-------. 1 root root 14792166 Nov  5 04:44 /var/log/messages-20171105
-rw-------. 1 root root   325138 Nov  6 08:52 /var/log/messages

Additional info:
This bug should be fixed in logrotate 3.12.0 or later. See https://github.com/logrotate/logrotate/releases/tag/3.12.0 for changelog (item "weekly rotations are now predictable and configurable (#93)). Updating to this version, or the latest upstream version, should fix this bug.

Alternatively, the test in logrotate.c should be patched to be less obsessive about what constitutes a week. The Debian bug report for this has a patch to allow 60 seconds of jitter, which might work if you only run logrotate at a consistent time from a crontab entry, but won't be sufficient for the often several hours of variability when running from cron.daily. Rather than 60 s, the jitter should be more like 6 hours (6 * 3600). See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825776 for that attempted solution. (The follow-up discussion recommended the upstream fix instead.)

Comment 2 Kamil Dudka 2017-11-06 16:07:19 UTC
Indeed.  We are going to fix this bug in RHEL-7.5.  Let me check if we can disclose the corresponding bug (bug #1465720) for public to avoid reporting duplicates like this.

Comment 3 Kamil Dudka 2017-11-07 13:21:01 UTC
Done.  Please comment on bug #1465720 if you have any follow-up on this...

*** This bug has been marked as a duplicate of bug 1465720 ***


Note You need to log in before you can comment on or make changes to this bug.