Logrotate not rotating on file size

0

According to the man page "Normally, logrotate is run as a daily cron job. It will not modify a log multiple times in one day unless the criterium for that log is based on the log’s size". So, this means that even though cron runs hourly/daily/weekly, if I set a size parameter, cron settings will be ignored and the file will be rotated as soon as its size reaches, e.g., 10k.

I have the following in my logrotate.conf but the maillog is not rotated, i.e., the touch /var/log/maillog is not executed:

/var/log/maillog
{
    missingok
    notifempty
    nocompress
    size=10k
    postrotate
        touch /var/log/maillog
    endscript
}

What is wrong here?

Jay

Posted 2014-12-10T12:48:37.797

Reputation: 1

Answers

1

The issue is your syntax - size=10k should be size 10k as follows:

/var/log/maillog { missingok notifempty nocompress size 10k postrotate touch /var/log/maillog endscript }

harwig

Posted 2014-12-10T12:48:37.797

Reputation: 121