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


MySQL-SlowLog-Filter documentation  | view source Contained in the MySQL-SlowLog-Filter distribution.

Index


NAME

Top

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

SYNOPSIS

Top

    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

Top

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

Top

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

Top

* incremental
* no-duplicates
* sorting

SEE ALSO

Top

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

COPYRIGHT & LICENSE

Top


MySQL-SlowLog-Filter documentation  | view source Contained in the MySQL-SlowLog-Filter distribution.