Error log rotation on crash

So I’ve noticed that if the server ends in a non-graceful fashion, i.e., crashes randomly, it creates a new error log file with the date appended.

In our environment, errors log to /var/log/mysql/mysqld.log and we have a logrotate config set to rotate weekly and then gzip. However, if the server crashes, everything before that crash is automatically moved to mysqld.log-YYYYMMDD. Not only does this break the logrotate config, but sometimes the server continues to log to the mysqld.log-YYYYMMDD file.

Is this the intended behavior on crashes? It would be nice to have everything continue to log to the main file, as that’s how flush logs has behaved for awhile now.

Hi,

From http://dev.mysql.com/doc/refman/5.5/en/log-file-maintenance. html seems that mysql doesn’t create those mysqld.log-YYYYMMDD files, if you flush the logs mysql creates mysqld.log-old. so that other file is being created by some other thing. and logging to a mysqld.log-YYYYMMDD needs a change on my.cnf and a server restart, is not a dynamic variable.

AFAIK, that behavior is not mysql standard. something else (a patch) or another software is doing that. Can you provide the MySQL server version, OS version and the script which you are using to log rotate?