
MySQL::SlowLog::Filter - MySQL Slow Query Log Filter

use MySQL::SlowLog::Filter qw/run parse_date_range parse_time/;
run('slow.log', {
date => '13.11.2006-01.12.2008', # see parse_date_range below
'include-host' => \@include_hosts,
'exclude-host' => \@exclude_hosts,
'include-user' => \@include_users,
'exclude-user' => \@exclude_users,
min_query_time => 30,
} );

The code is heavily borrowed from http://code.google.com/p/mysql-log-filter/
It is not complete, use it at your own risk.

run $params on $file_name
date => '13.11.2006-01.12.2008'
date => '>13.11.2006'
check parse_date_range below
# Query_time: 221 Lock_time: 0 Rows_sent: 241 Rows_examined: 4385615
compare with "Query_time". default is -1. means all.
compare with "Rows_examined". default is -1. means all.
# time epoch
my ( $start, $end ) = parse_date_range($Input);
Input Return
'' ( 0, 9999999999 )
>13-11-2006 ( 1163347200, 9999999999 )
<13/11/2006 ( 0, 1163347200 )
-13.11.2006 ( 0, 1163347200 )
13.11.2006-1.12.2008 ( 1163347200, 1228060800 )
13.11.2006-01.12.2008 ( 1163347200, 1228060800 )
13/11/2006-01-12-2008 ( 1163347200, 1228060800 )
Return a unix timestamp from the given date.
Return a unix timestamp from the given date. (070119 12:29:58)


http://mysql-log-filter.googlecode.com/svn/trunk/mysql_filter_slow_log.py

Copyright 2008 Fayland Lam, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.