Chinaunix
标题:
日志分析,不断分析
[打印本页]
作者:
651260546
时间:
2017-06-29 13:24
标题:
日志分析,不断分析
日志文件
112.17.238.167 - 0.648 - [28/Jun/2017:11:07:26 +0800] "GET /api/trusteeship_order/number?identity=provider HTTP/1.1" api.shipindiy.com 200 242 "-" "MatchingPlatform/2.
2.1 (iPhone; iOS 8.0.2; Scale/3.00)" "-"
112.17.238.167 - 0.654 - [28/Jun/2017:11:07:26 +0800] "GET /api/trusteeship_order/number?identity=provider HTTP/1.1" api.shipindiy.com 200 242 "-" "MatchingPlatform/2.
2.1 (iPhone; iOS 8.0.2; Scale/3.00)" "-"
[root@nagios shell]# vim jushi.log
需求是 这是个不断产生的日志文件, 我需要2小时分析下 ,0.648 这个值有没有超过0.5的,然后记录超过的数量,在2过2小时继续分析,但要排除前面分析过的部分
作者:
关阴月飞
时间:
2017-06-30 09:14
本帖最后由 关阴月飞 于 2017-06-30 09:56 编辑
如果日志有按天做轮转, 可以设置crontab 每两个小时执行一次cat xx.sh
#!/bin/bash
awk -F '[: ]+' 'BEGIN{time_end=strftime("%H",systime());time_start=time_end-2} $6>=time_start && $6<time_end && $3>0.5 {n++} END{print time_start,time_end-1,n}' urfile >/tmp/log_file
crontab -e
0 */2 * * * /bin/bash xx.sh
作者:
本友会机友会摄友会
时间:
2017-06-30 15:44
提示:
作者被禁止或删除 内容自动屏蔽
作者:
yexingqi
时间:
2017-07-07 09:31
本友会机友会摄友会 发表于 2017-06-30 15:44
txt无索引,行,列无法跳转,或跳转难。这就是txt这【祖奶文件格式】最大的悲哀。
所以,现在都入库了。
...
powershell大师,你用的是windows powershell还是linux下面的powershell啊? 有没有什么入门的教程学习一下?
作者:
本友会机友会摄友会
时间:
2017-07-07 15:46
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2