Find the answer to your Linux question:
Results 1 to 2 of 2
I have a problem where logrotate wont remove old rotated files. I've googled and googled and believe i have everything set up correctly .. /etc/logrotate.conf # rotate log files weekly ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    5

    Logrotate - not removing old files - driving me insane !


    I have a problem where logrotate wont remove old rotated files. I've googled and googled and believe i have everything set up correctly ..

    /etc/logrotate.conf
    # rotate log files weekly
    weekly

    # keep 4 rotated files
    rotate 4

    missingok
    notifempty

    create

    # use date as a suffix of the rotated file
    dateext

    # uncomment this if you want your log files compressed
    compress

    # compression scheme
    compresscmd /usr/bin/gzip
    uncompresscmd /usr/bin/gunzip

    include /etc/logrotate.d


    /etc/logrotate.d/ora_alert
    /[A-Z]*/dbase/dbs/bdump/alert_*.log {
    daily
    rotate 28
    maxage 28
    compress
    dateext
    notifempty
    missingok
    copytruncate
    nocreate
    }


    I would expect /etc/logrotate.d/ora_alert to run daily and remove any rotated files older than 28 days (maxage 2, but I still have rotated files from January 11th (today is 27th April). It does gzip log files every day, but isn't removing any.

    I am thinking maybe I have to manually remove any rotated files from before I made the maxage change to the logrotate config file ?

    Many thanks in advance

  2. #2
    Just Joined!
    Join Date
    Nov 2007
    Location
    San Diego
    Posts
    17
    Sometimes it helps to run logrotate -d, or -f to make sure everything is working properly.

    e.g.
    logrotate -f /etc/logrotate.d/ora_alert

    Then check the contents of the files to see if they are overwritten with new files, and if the date changes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •