Preventing logrotate's dateext from overwriting files

Posted by Thirler on Server Fault See other posts from Server Fault or by Thirler
Published on 2011-05-06T09:09:56Z Indexed on 2012/12/11 11:05 UTC
Read the original article Hit count: 241

Filed under:
|

I'm working with a system where I would like to use the dateext function of logrotate (or some other way) to add the date to a logfile when it is rotated. However in this system it is important that no logging is missing and dateext will overwrite any existing files (which will happen if logrotate is called twice on a day).

Is there a reliable way to prevent dateext to overwrite existing files, but instead make another file?. It is acceptable that either no rotate happens or a file is created with a less predictable name (date with an extra number, or the time or something).

© Server Fault or respective owner

Related posts about logging

Related posts about logrotate