wilzokch / mysql-log-filter

Automatically exported from code.google.com/p/mysql-log-filter
1 stars 0 forks source link

invalid literal for int() #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
mysql-slow.log
================================================
/usr/sbin/mysqld, Version: 5.5.13-log (MySQL Community Server (GPL)). started 
with:
Tcp port: 3306  Unix socket: /var/dbstore/run/mysqld-abcd.sock
Time                 Id Command    Argument
# Time: 110812  0:01:10
# User@Host: abcd[abcd] @  [10.xx.xx.xx]
# Query_time: 8.023402  Lock_time: 0.000047 Rows_sent: 8321  Rows_examined: 8321
use abcd;
SET timestamp=1313132470;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `products`;
======================================================

2.
/usr/bin/python /usr/local/scripts/mysql_filter_slow_log.py 
--sort-max-query-time mysql-slow.log --date=12.08.2011
======================================================
Traceback (most recent call last):
  File "/usr/local/scripts/mysql_filter_slow_log.py", line 469, in ?
    query_time = (int(numbers[1].split()[0]), int(numbers[2].split()[0]),
ValueError: invalid literal for int(): 8.023402

======================================================

What is the expected output? What do you see instead?
Looks like this script is not able to parse floating values in query_time

What version of the product are you using? On what operating system?

mysql-log-filter-1.9
MySQL 5.5
RHEL 5

Please provide any additional information below.

Original issue reported on code.google.com by jaykumar...@gmail.com on 12 Aug 2011 at 12:45

GoogleCodeExporter commented 8 years ago
Looks like even a non-integer Lock_time would cause the error.

Original comment by jaykumar...@gmail.com on 12 Aug 2011 at 1:10

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Both the python and php version expect integers in the log file like the 
following:
# Query_time: 0  Lock_time: 0  Rows_sent: 0  Rows_examined: 156

Until anyone rewrites the script to work with floats, you can filter the slow 
query log with sed like the following:
cat mysqld-slow.log | sed -r 's/([0-9])\.([0-9]{6})/\1\2/g' > 
mysqld-slow-int.log

When running the reports, the script will work like expected, just remember 
that all times in the reports are microseconds, not seconds :)

Original comment by fredrik....@gmail.com on 16 Dec 2011 at 4:44