2

How can I set log rotate to, /var/log/messages files, all the files with the name "messages", rotate every 4 days (to keep last 4 files), not to generate any error messages??

/var/log/messsages-* { dateext maxage 3 rotate 4 missingok nocompress }

Is this correct?

1 Answers1

0

No. Unless you are moving the files out of that directory with the olddir directive, you should never end your regex path with a wildcard:

Please use wildcards with caution. If you specify *, logrotate will rotate all files, including previously rotated ones. A way around this is to use the olddir directive or a more exact wildcard (such as *.log).

You will end up with an infinitely-repeating cycle of rotations. You do not need a wildcard at all in your directive definition.

parttimeturtle
  • 1,125
  • 7
  • 22