I had a logrotate
configuration file set up for a log (let's call it Log1). It is working fine and the log is rotating everyday as expected.
Yesterday I cloned this set up and modified it for three more log files Log2, Log3 and Log4. These log files already exist on disk, and are being actively written to.
However, when checked today, the three log files did not rotate at all. I was expecting them to rotate along with the first log file Log1. But only Log1 was rotated, and the rest (Log2 to Log4) weren't touched at all.
If I place new configuration files for logrotate
, do I have to run a command to "activate" them so logrotate
will start rotating the log files? I thought since it's a cron
job running at 4 am everyday, it will automatically pick up the new files and rotate files. Is there some sort of manual activation needed?
What's strange is that the /var/lib/logrotate.status
file seems to show (with today's date) that all four log files were looked at by logrotate
. So, why did logrotate
skip the three new log files that obviously need rotating?
Configuration file:
/path/to/Log1.log {
compress
compresscmd /usr/bin/bzip2
compressext .bz2
compressoptions -9
copytruncate
daily
dateext
delaycompress
extension .log
notifempty
missingok
nomail
olddir Log1
rotate 100
maxage 60
}
There shouldn't be anything wrong with the configuration file, since it works fine for Log1. The olddir
directory is already created for all the logs.
When running logrotate -d
(debug mode), it says log does not need rotating
for all four logs. I understand this is correct for Log1
since it's already rotated, but what about the others?
Does it have anything to do with after 1 days
? Does logrotate
first mark the new file's date in logrotate.status
file, then only rotate when one day has elapsed since the last mark? How is the status file used by logrotate
?
logrotate -d
(debug mode) show anything enlightening? Maybe there's one more place you need to change the filename in the config file (I'm sure this not only happens to me?).logrotate
runs with high privileges, so there shouldn't be permissions issues, like being unable to read/create the files, but double-checking can't hurt.log does not need rotating
for all four logs. I understand this is correct for Log1 since it's already rotated, but what about the others? Also, all owners, groups, rights are exactly the same for all four log files and related files/directories.after 1 days
? Doeslogrotate
first mark the new file date's inlogrotate.status
file, then only rotate when one day has elapsed since the last mark? How is the status file used bylogrotate
?minsize
setting in the logrotate configuration? If the new files haven't reached that size they won't be rotated.