I turned on mysql general log, and since it was growing pretty fast I thought of using logrotate daily, so I created the log yesterday at about 2pm and this is how the log looks like:
-rw-rw---- 1 mysql adm 1751348 Jun 16 11:55 general.log
I added a new rule to logrotate which looks like this:
/var/log/mysql/general.log {
daily
rotate 12
dateext
compress
missingok
notifempty
create 640 mysql adm
postrotate
/usr/bin/killall -HUP rsyslogd
endscript
}
And according to /etc/crontab it runs at 6:25am, but it didn't rotate my log yesterday
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
the output of running logrotate --dry-run:
logrotate -d general
reading config file general
reading config info for /var/log/mysql/general.log
Handling 1 logs
rotating pattern: /var/log/mysql/general.log after 1 days (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/mysql/general.log
log does not need rotating
not running postrotate script, since no logs were rotated
What else do I have to do so it rotates my log?
logrotatewith the-dflag to see what's going on.anacron. This is unrelated, but why do you need to do that?