NAME
MySQL::SlowLog::Filter - MySQL Slow Query Log Filter
SYNOPSIS
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,
} );
DESCRIPTION
The code is heavily borrowed from http://code.google.com/p/mysql-log-filter/
It is not complete, use it at your own risk.
METHODS
run( $file_name, $params )
run $params on $file_name
PARAMS
- date
-
date => '13.11.2006-01.12.2008' date => '>13.11.2006'
check parse_date_range below
- include-host
- exclude-host
- include-user
- exclude-user
- min_query_time
-
# Query_time: 221 Lock_time: 0 Rows_sent: 241 Rows_examined: 4385615
compare with "Query_time". default is -1. means all.
- min_rows_examined
-
compare with "Rows_examined". default is -1. means all.
parse_date_range
# 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 )
parse_time
Return a unix timestamp from the given date.
get_log_timestamp
Return a unix timestamp from the given date. (070119 12:29:58)
TODO
incremental
no-duplicates
sorting
SEE ALSO
http://mysql-log-filter.googlecode.com/svn/trunk/mysql_filter_slow_log.py
COPYRIGHT & LICENSE
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.