Skip to content

MySQL Logrotate

/etc/logrotate.d/mysql

/var/log/mysql/*.log
{
    create 0660 mysql mysql
    compress
    dateext
    rotate 8
    weekly
    missingok
    postrotate
      # just if mysqld is really running
      if test -x /usrbin/mysqladmin && /usr/bin/mysqladmin ping &>/dev/null
      then
         /usr/bin/mysqladmin flush-logs
      fi
    endscript
}