views:

41

answers:

2

I am trying to write a script to parse the MySQL slow query log. I have seen 1 or 2 parser. does anyone know how to extract the information from that log? I mean does anyone know the structure of the file so I can work with that and if anyone know a good parser for this log file?

thanks

+1  A: 

This is a good read and suggests some tools: http://www.mysqlperformanceblog.com/2006/09/06/slow-query-log-analyzes-tools/

Just in case you miss it: http://www.maatkit.org/doc/mk-query-digest.html is the suggested tool. But worth a read anyway.

If you have to write somethin on your own there seems to be a handy perl module on cpan. http://search.cpan.org/~dnichter/MySQL-Log-ParseFilter-1.00/lib/MySQL/Log/ParseFilter.pm

neal aise
+1  A: 

The mysqldumpslow tool comes with MySQL and is useful in some cases for parsing the slow query log.

You should try it out:

http://dev.mysql.com/doc/refman/5.1/en/mysqldumpslow.html

Ike Walker