-
https://github.com/wubx/mysql-binlog-statistic/blob/master/bin/cutlogbytime
-
时间需要写时戳
-
mysql> select unix_timestamp('2013-04-05');
+------------------------------+
| unix_timestamp('2013-04-05') |
+------------------------------+
| 1365091200 |
+------------------------------+
1 row in set (0.00 sec)
mysql> select unix_timestamp('2013-04-06');
+------------------------------+
| unix_timestamp('2013-04-06') |
+------------------------------+
| 1365177600 |
+------------------------------+
1 row in set (0.00 sec)
-
-
./cutlogbytime /path/slowlogfile 1365091200 1365177600 > 20130405_slow.log
这样得到一天的日志文件就小一点的也容易分析了。而且可以根据天的文件,在取一天的某个时间点的日志。