7

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.

2 Answers 2

6

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
}
5

Try this option:

notifempty
    Do not rotate the log if it is empty (this overrides the ifempty option).

Source: http://linux.die.net/man/8/logrotate

2
  • I tried that too. But still the sizes of the rotated logs are different from one another, instead of all having 10M size, Infact, some are more than 10M.
    – NixMan
    Jan 21, 2013 at 6:19
  • 1
    @NixMan: They won't have exactly the same size. Just look at the manual: "Log files are rotated when they grow bigger than size bytes. [...]"
    – 0xFF
    Jan 25, 2013 at 9:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .