提高日志分析效率的几个小手段

使用标记

有的时候,逻辑太复杂,我们需要多处日志结合才能确定问题的根源。使用标记可以帮助我们将多个怀疑点收纳在一起,避免前后不停的翻找,降低记忆负担,提高效率。

标记的方法有如下几中:

  1. 将可疑点保存在新的页签中, 比如:

在这里插入图片描述

  1. 借助支持标记的工具,比如:

在这里插入图片描述

使用多词匹配

多词匹配分为且关系和或关系,且关系用于过滤出同时包含多个关键词的行,比如同时包含“http”和“error”可以过滤出所有的http请求错误;或关系用于过滤包含任意一个给定关键词的行,比如任意包含“error”、“fail”、或“exception”可以过滤出所有错误、失败、异常的行。

使用且关系的方法有如下几种:

  1. 管道,比如:
cat log.log | grep "4.4753820a.chunk.js" | grep "failed"

输出结果如下:

Tue Aug 01 2023 19:57:18 GMT+0800 (中国标准时间) 30169 [app] _fileSendingEnd(): file sending failed: '/home/server/app/xxx/debug/public/loger/static/js/4.4753820a.chunk.js.gz':  Error: Request aborted
Wed Aug 02 2023 10:10:49 GMT+0800 (中国标准时间) 30169 [app] _fileSendingEnd(): file sending failed: '/home/server/app/xxx/debug/public/loger/static/js/4.4753820a.chunk.js.gz':  Error: read EHOSTUNREACH
Fri Aug 04 2023 14:14:11 GMT+0800 (中国标准时间) 30169 [app] _fileSendingEnd(): file sending failed: '/home/server/app/xxx/debug/public/loger/static/js/4.4753820a.chunk.js.gz':  Error: Request aborted
Fri Aug 04 2023 18:16:25 GMT+0800 (中国标准时间) 30169 [app] _fileSendingEnd(): file sending failed: '/home/server/app/xxx/debug/public/loger/static/js/4.4753820a.chunk.js.gz':  Error: write EPIPE
Sun Aug 06 2023 11:08:51 GMT+0800 (中国标准时间) 30169 [app] _fileSendingEnd(): file sending failed: '/home/server/app/xxx/debug/public/loger/static/js/4.4753820a.chunk.js.gz':  Error: write EPIPE
Wed Aug 09 2023 10:24:45 GMT+0800 (中国标准时间) 30169 [app] _fileSendingEnd(): file sending failed: '/home/server/app/xxx/debug/public/loger/static/js/4.4753820a.chunk.js.gz':  Error: Request aborted
Wed Aug 09 2023 11:44:42 GMT+0800 (中国标准时间) 30169 [app] _fileSendingEnd(): file sending failed: '/home/server/app/xxx/debug/public/loger/static/js
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值