Bug 1873378 - rancid.logrotate file is unsuitable for timestamped logfiles
Summary: rancid.logrotate file is unsuitable for timestamped logfiles
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: rancid
Version: epel7
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: David Brown
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-28 05:08 UTC by dan.kerse
Modified: 2022-02-17 03:16 UTC (History)
7 users (show)

Fixed In Version: rancid-3.13-3.el7 rancid-3.13-3.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-17 02:43:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description dan.kerse 2020-08-28 05:08:16 UTC
Description of problem:

rancid.logrotate is not suitable for deploying with Rancid because the logfiles are timestamped.

The EPEL7 sources haven't changed since I installed in 2015. When I installed locally I did notice some issues, and made some minor changes: 

$ cat /etc/logrotate.d/rancid
/var/log/rancid/* {
    weekly
    rotate 1
    #notifempty
    missingok
    compress
    olddir old

    ifempty
    nocreate
}

However using olddir is really not suitable here as the filenames contain a timestamp. Once they end up in /var/log/rancid/old they never get removed.

Naively I created a cron job, based on FAQ #10 (
https://github.com/haussli/rancid/blob/babfe8344de57f70f01d749ebfb4bcfcc492d4d4/README ) to remove the olddir files.

$ crontab -l  | grep -B1 find
# Clean out month-old config differ logs daily at 23:50
50 23 * * * nice /usr/bin/find /var/log/rancid/old -mtime +30 -exec /usr/bin/rm {} \;

However this does not prevent /var/lib/logrotate.status filling up.

$ cat /var/lib/logrotate.status | awk '{print $2}' | cut -d- -f1 | sort | uniq -c
      7 2015
  96403 2016
 308585 2017
 302782 2018
 292858 2019
 204930 2020
      1 state

I'd also like to point out that NONE of the modifications I made to the RPM install would have lead to /var/lib/logrotate.status



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

How reproducible:
Easily

Steps to Reproduce:
1. Install Rancid
2. Collect Configs on a regular basis
3. Wait five years or so

Actual results:
/var/lib/logrotate.status grows into a snowball

Expected results:
/var/lib/logrotate.status does not grow. 

Additional info:
I would suggest removing rancid.logrotate and replacing it with rancid.cron
Perhaps adding a less clumsy version of this to rancid.cron:
# Clean out month-old config differ logs daily at 23:50
50 23 * * * rancid nice /usr/bin/find /var/log/rancid/old -mtime +30 -exec /usr/bin/rm {} \;

Comment 1 Fedora Update System 2022-02-08 13:52:52 UTC
FEDORA-EPEL-2022-abe90b7930 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-abe90b7930

Comment 2 Fedora Update System 2022-02-08 13:53:29 UTC
FEDORA-EPEL-2022-076fdd31f3 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-076fdd31f3

Comment 3 Fedora Update System 2022-02-09 01:34:57 UTC
FEDORA-EPEL-2022-076fdd31f3 has been pushed to the Fedora EPEL 7 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-076fdd31f3

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2022-02-09 01:35:08 UTC
FEDORA-EPEL-2022-abe90b7930 has been pushed to the Fedora EPEL 8 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-abe90b7930

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2022-02-17 02:43:42 UTC
FEDORA-EPEL-2022-076fdd31f3 has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2022-02-17 03:16:24 UTC
FEDORA-EPEL-2022-abe90b7930 has been pushed to the Fedora EPEL 8 stable repository.
If problem still persists, please make note of it in this bug report.


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