想学好“三剑客”最基本还是 正则表达式的熟练
日志的格式
2018/10/03 23:59:14.944 adapter.go:353: [warning] [SLOW_QUERY] cost_time:111.420169ms succ:true connection_id:0 txn_start_ts:403375431254540289 database: table_ids:[21] index_ids:[1] sql:select tab_id, is_ind, hist_id, distinct_count, version, null_count, tot_col_siz from mysql.stats_histograms where table_id = 40373
...
grep "[0-9]m[0-9]" slow-log-2018-10-06.log |awk -F":" ‘{print $6, $NF}‘ |sed ‘s/succ//g‘ > slow_sql-2018-10-08.log
grep "[4-6][0-9]\.[0-9]\{2,\}s" slow-log-2018-10-06.log
grep ":9[0-9][0-9]\." slow-log-2018-10-06.log |awk -F":" ‘{print $6, $13}‘ | grep ‘limit‘
原文地址:http://blog.51cto.com/11114389/2296033
时间: 2024-10-23 08:36:46