I have log rotation setup in /etc/logrotate.d/mysql:
/var/lib/mysql/mysql*.log {
# create 600 mysql mysql
notifempty
daily
dateext
rotate 7
missingok
compress
postrotate
# just if mysqld is really running
if test -x /usr/bin/mysqladmin && \
/usr/bin/mysqladmin ping &>/dev/null
then
/usr/bin/mysqladmin flush-logs
fi
endscript
}
However, this does not appear to be working correctly. On one system I have log rotation occuring as desired (new log file daily) but I have a month of log files (not 7). On another system I have log rotation occuring but writes are happening to a file labeled mysql-slow.log-20150204. Not quite sure where the break down is at this point and the blog has some good guidance but maybe it’s out of date?
Any help (or logrotate.d examples) would be much appreciated.