Bug #38702 Support rotation for the slow query log
Submitted: 10 Aug 2008 17:57 Modified: 11 Aug 2008 12:15
Reporter: Mark Callaghan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S4 (Feature request)
Version:5.0,5.1 OS:Any
Assigned to: CPU Architecture:Any
Tags: flush, log, query, rotate, slow

[10 Aug 2008 17:57] Mark Callaghan
Description:
I want rotation for the slow query log. This needs a flush command to be done. When it is run, the current log is closed and a new one is opened. The logs should be numbered as well. Without this, the only way to rotate a slow query log is to stop the server, move the existing file and restart the server.

We can send you a patch for this.

How to repeat:
NA

Suggested fix:
Change the code. We can provide a patch.
[10 Aug 2008 18:11] Davi Arnaut
You can do something similar with the event scheduler and rename table. Anyway, please submit the patch so we can take a look.
[10 Aug 2008 18:33] Mark Callaghan
The event scheduler is one more thing that can go wrong when I run a server in production. File rotation is a much simpler solution.
[11 Aug 2008 10:59] Sheeri Cabral
++ on this.  flush logs should rotate the slow query log.  Mark, sounds like you should send your code in....
[11 Aug 2008 12:15] Susanne Ebrecht
Many thanks for writing a feature request.

I think this is a very useful feature. Please add the patch.
[3 Oct 2008 2:18] Yuan Wei
Slow query rotation log

Attachment: mysql-5.0.67_slowquerylogrotation.patch (text/x-patch), 10.47 KiB.

[3 Oct 2008 2:20] Yuan Wei
Hi, Mark,

I have uploaded our slow query rotation patch. The patch is based on mysql-5.0.67.