Rotating General Logfile
Posted by: Dan Casey
Date: June 21, 2005 08:55AM

DB: Mysqld 4.0.20 (usually... otherwise 4.0.xx)
OS: RHEL 3


Hello,

This has never been a problem for me in the past, because I didn't mind have 2 seconds of downtime. But now I need to be able to rotate a log file without restarting mysql. Note: I am reffering to the log file that shows every query that is run, not the binary log.

Here is what I am currently doing. It's a one liner, but I'll seperate them so its more readable.

1 # mv mysqld.log mysqld.log.0
2 # touch mysqld.log
3 # chown mysql:mysql mysqld.log
4 # chmod 600 mysqld.log
5 # mysqladmin -u root -pmy_secret_password flush-logs

the entire process seems to take less then one second on my test server. The only problem with this, is that any queries that occur between steps 1 and 5 are not logged anywhere. This may seem silly to some of you, but it is critical that I do not lose a single query.

Is there a better method of doing this. (that does not shut down mysql).
It would be nice if mysql buffered the logs for a few seconds then wrote them to the new logfile...

Options: ReplyQuote


Subject
Written By
Posted
Rotating General Logfile
June 21, 2005 08:55AM
June 21, 2005 10:09AM
June 21, 2005 07:37PM
June 21, 2005 08:36PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.