-1

I have implemented Log rotation as :-

    /data/mule/logs/*.log {
    rotate 1
    size 20M
    missingok
    noolddir
    nomail
    notifempty
    create 644 root root
    compress
    }

But the logs are not getting rotated continuously if the size increases beyond limit. It rotates only once in a day.

Can anyone help me to continuously check the logs in the path and if it exceeds the limit of 20mb it should be rotated.


I have configured in the crontab to run every 5 minutes. However I am getting below error while running it :

    /etc/logrotate.d/mule: line 1: /data/mule/logs/app.zip.log: Text file busy
    /etc/logrotate.d/mule: line 2: rotate: command not found
    /etc/logrotate.d/mule: line 3: minsize: command not found
    /etc/logrotate.d/mule: line 4: missingok: command not found
    /etc/logrotate.d/mule: line 5: noolddir: command not found
    /etc/logrotate.d/mule: line 6: nomail: command not found
    /etc/logrotate.d/mule: line 7: notifempty: command not found
    /etc/logrotate.d/mule: line 8: create: command not found
    /etc/logrotate.d/mule: line 9: compress: command not found
    /etc/logrotate.d/mule: line 10: syntax error near unexpected token `}'
    /etc/logrotate.d/mule: line 10: `}'

I have added the below in my crontab :-

    */5 * * * * /etc/logrotate.d/mule
Arpit
  • 1
  • 2
    You're attempting to execute a config file. Unsurprisingly, this isn't going well for you. – womble Jul 21 '16 at 00:58

1 Answers1

2

Logrotate is not a daemon/service running in the background. Logrotate is run via cron (look at /etc/crontab or somewhere in /etc/cron.d/...).

You can adjust the frequency how often it is run there. However it will never do want you want, i.e. really check continuously.

You will have to test how it behaves (what are the archive names, etc.) when run more often than once a day. Since you didn't use the dateext option you are probably fine and it will simply increased the suffix (i.e. log.1.bz2, log.2.bz2 etc.)

Marki
  • 2,854
  • 3
  • 28
  • 45