Linux-日志文件分析

查看最近访问量最⾼的页⾯(.php)
cat access_log |awk '{print $7}'|grep '.php'|sort|uniq -c|sort -nr |head -n 10
#查看80端⼝的tcp连接
netstat -tan | grep "ESTABLISHED" | grep ":80" | wc -l
#当前WEB服务器中联接次数最多的ip地址:
netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r
#查看⽇志中访问次数最多的前10个IP
cat access_log |cut -d ' ' -f 1 |sort |uniq -c | sort -nr | awk '{print $0 }' | head -n 10 |less
#查看⽇志中出现100次以上的IP
cat access_log |cut -d ' ' -f 1 |sort |uniq -c | awk '{if ($1 > 100) print $0}'|sort -nr |less
#查看最近访问量最⾼的⽂件
cat access_log |tail -10000|awk '{print $7}'|sort|uniq -c|sort -nr|less
#查看⽇志中访问超过100次的页⾯
cat access_log | cut -d ' ' -f 7 | sort |uniq -c | awk '{if ($1 > 100) print $0}' | less
#access_log昨天⼀天的点击量(clicks);
cat access_log|grep '12/Nov/2009'|grep "******.jsp"|wc|awk '{print $1}'|uniq
#统计某url,⼀天的访问次数
cat access_log|grep '12/Aug/2009'|grep '/p_w_picpaths/index/e1.gif'|wc|awk '{print $1}'
#昨天访问⽹站的独⽴IP有多少;
cat access_log|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq
#拉出前五天的访问次数最多的⽹页前20名清单;进⾏五天⽇志对⽐,找出排名靠前重复的⽹页,即可得出本周访问量最⼤的前⼏个⽹
页;
cat access_log|awk '{print $7}'|uniq -c |sort -n -r|head -20
#从⽇志⾥查看该ip在⼲嘛:
cat access_log | grep 218.66.36.119| awk '{print $1"\t"$7}' | sort | uniq -c | sort -nr | less
#列出传输时间超过 30 秒的⽂件
cat access_log|awk ‘($NF > 30){print $7}’|sort -n|uniq -c|sort -nr|head -20
#列出最最耗时的页⾯(超过60秒的)的以及对应页⾯发⽣次数
cat access_log |awk ‘($NF > 60 && $7~/\.php/){print $7}’|sort -n|uniq -c|sort -nr|head -10

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值