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.

Oldskool
  • 2,025
  • 1
  • 16
  • 27
NixMan
  • 191
  • 1
  • 1
  • 5

2 Answers2

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
}
Gregory MOUSSAT
  • 1,673
  • 2
  • 25
  • 50
Anthony
  • 84
  • 1
  • 1
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

0xFF
  • 368
  • 1
  • 8
  • 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 '13 at 06: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 '13 at 09:44