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

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

使用多词匹配
多词匹配分为且关系和或关系,且关系用于过滤出同时包含多个关键词的行,比如同时包含“http”和“error”可以过滤出所有的http请求错误;或关系用于过滤包含任意一个给定关键词的行,比如任意包含“error”、“fail”、或“exception”可以过滤出所有错误、失败、异常的行。
使用且关系的方法有如下几种:
- 管道,比如:
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

最低0.47元/天 解锁文章
1735

被折叠的 条评论
为什么被折叠?



