Cron – Logrotate Creating Empty Rotated Files

cronlogrotate

I have the following parameters set up for the log rotation of a log. size=10M, rotate 800, copytruncate, missingok. 800 rotated files are being created, but many of them are below 10M and some of them are empty with 0 size.

I have a cron setup as * * * * * which runs every minute to do this logrotation. I don't want this, can't understand why it is happening.

Best Answer

Even i had same issues, after adding "nocreate" option issues is solved.

/opt/postgres/9.1/data/pg_log/postgresql*.log {
        missingok
        compress
        daily
        rotate 7
        maxage 7
        minsize 5
        notifempty
        size 5M
    nocreate
}