命令
查看指定接口的访问IP |
cat access.log | grep "/op-center/v1/bike/unlock" | awk -F " " '{print $1}' | sort | uniq |
查看请求的接口的 topN |
grep -E '22:55:0[1-9]' server-skywalking.2021-10-06-4.log | awk -F" " '{print $8}'|sort|uniq -c|sort -nrk 1 -t ' '|head -10 |
日志都已经打包压缩,尝试解压没有权限。打开的日志,命令为 |
zgrep -a '关键字' server-info.log.tar.gz |
多关键字查询 且 |
grep '关键字1' server-skywalking.log | grep '关键字1' |
最近看机器的时候需要看日志,用grep命令就可以查看 上下10行: 上面10行: 下面10行: |
-C -B grep -A 10 '2022-05-19 11:18:07.649' server-skywalking.log |
查看分支创建人 |
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n |
SQL
-- 分时分段统计。效果下见下图 SELECT date_add( '2021-9-5 00:00:00', interval 15 * floor( timestampdiff(minute, '2021-9-5 00:00:00', `start_time`) / 15 ) MINUTE ) as count_time_start, worker_id, worker_name, count(*), floor( timestampdiff(minute, '2021-9-5 00:00:00', `start_time`) / 15 ) as serial_num FROM tableName where cur_date in ("2021-9-5") and city_id = 227 group by floor( timestampdiff(minute, '2021-9-5 00:00:00', `start_time`) / 15 ), worker_id
按月统计(一) select date_format(create_time, '%Y-%m') mont, count(*) coun from tableName group by date_format(create_time, '%Y-%m'); 按天统计(二) select date_format(create_time, '%Y-%m-%d') dat, count(*) coun from tableName group by date_format(create_time, '%Y-%m-%d'); 按天统计(三) select from_unixtime(create_time / 1000, '%Y-%m-%d') dat, count(*) coun from tableName group by from_unixtime(create_time / 1000, '%Y-%m-%d') 其他 select from_unixtime(create_time / 1000, '%Y-%m-%d %H:%i:%S') create_time from tableName