How can I specify multiple rules for a particular log file(s) with logrotate?

Posted by Ether on Server Fault See other posts from Server Fault or by Ether
Published on 2012-05-07T19:48:43Z Indexed on 2013/11/09 9:59 UTC
Read the original article Hit count: 236

Filed under:

I have a logrotate.d config file that looks something like this:

/home/myapp/log/* {
    daily
    compress
    dateext
    ifempty
    delaycompress
    olddir /home/myapp/baklog
}

There are a few particular log files where I want to apply additional rules, such as "mail". How can I apply additional rules to just some files?

If I add another rule above that matches the additional files (e.g. /home/myapp/log/warning.log { ... }, I get an error like error: /etc/logrotate.d/myapp:3 duplicate log entry for /home/myapp/log/warning.log.

How can I specify multiple rules that match particular files in an overlapping kind of way?

© Server Fault or respective owner

Related posts about logrotate