51Testing软件测试论坛

标题: 如何利用linux日志分析问题举例说明,经常使用的相关命令是哪些 [打印本页]

作者: 测试积点老人    时间: 2020-6-4 15:00
标题: 如何利用linux日志分析问题举例说明,经常使用的相关命令是哪些
作为测试人员是否经常查看linux系统日志,如何利用linux日志分析问题举例说明,经常使用的相关命令是哪些



作者: bellas    时间: 2020-6-5 09:48
参考链接https://blog.csdn.net/risingsun001/article/details/49076861
作者: 郭小贱    时间: 2020-6-5 09:52
1. 查询访问量前10的IP地址
cat /tmp/access.log |cut -f 3 -d ' '| sort | uniq -c |sort -k 1 -n -r |head -10

2. 查询访问量前10的url
cat /tmp/access.log |cut -f 6 -d ' '|sort |uniq -c |sort -k 1 -n -r |head -10

3. 查询最耗时的页面
cat /tmp/access.log |sort -k 4 -n -r |head -10

4. 统计404请求的占比
export total_line=`wc -l access.log |cut -f 1 -d ' '` && export not_found_line=`awk '{if($8=="404")print $6}' access.log|wc -l` && expr $not_found_line \* 100 / $total_line

5. 统计访问量前十QPS的时间点
cat /tmp/access.log |cut -f 1 -d ' '|uniq -c |sort -k 1 -n -r |head -10
作者: qqq911    时间: 2020-6-5 10:43
tail  cat  ps
作者: 海海豚    时间: 2020-6-5 11:07
http://quan.51testing.com/pcQuan/chat/2986  参考下
作者: jingzizx    时间: 2020-6-5 13:03
sed




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2