I'm testing a logrotate configuration in /tmp. I'd like
- to configure a default logrotate policy for
/tmp/*.logfiles using my test configuration file/tmp/logrotate.conf - to handle a particular log file
/tmp/special.logwith a different policy configured in a separate logrotate config test file:/tmp/logrotate.d/included
But logrotate's response to my configuration is to say:
error: /tmp/logrotate.d/included:1 duplicate log entry for /tmp/special.log
What should I do differently?
Here's my /tmp/logrotate.conf
compress
missingok
notifempty
size 512k
copytruncate
rotate 2
su
# here's my attempt at applying the default policy to all /tmp/*.log
/tmp/*.log {}
# and here I intend to include any overrides
include /tmp/logrotate.d/included
And here's /tmp/logrotate.d/included
/tmp/special.log {
size 300
}
Here's the debug output.
$ sudo logrotate -d ./logrotate.conf
reading config file ./logrotate.conf
including /tmp/logrotate.d/included
reading config file /tmp/logrotate.d/included
error: /tmp/logrotate.d/included:1 duplicate log entry for /tmp/special.log
Handling 2 logs
rotating pattern: /tmp/*.log 524288 bytes (2 rotations)
empty log files are not rotated, old logs are removed
considering log /tmp/normal.log
log does not need rotating
considering log /tmp/special.log
log does not need rotating
rotating pattern: /tmp/special.log 300 bytes (2 rotations)
empty log files are not rotated, old logs are removed
No logs found. Rotation not needed.
- The error surprises me because I thought according to the man page "Later config files may override the options given in earlier files, so the order in which the logrotate config files are listed is important."
- Why does it say at the end when handling pattern
/tmp/special.logthat no logs were found? The file/tmp/special.logexists and is larger than 300 bytes.