Vue Advanced (Yao Lusi) Apache Access.log analysis summary

I. Introduction

During the debugging phase of the front-end project, you can use apache’sAccess.log to view the request log.

2. Common instructions

#查看80端口的tcp连接 

#netstat -tan | grep "ESTABLISHED" | grep ":80" | wc -l 

#当前WEB服务器中联接次数最多的ip地址: 

#netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r 

#查看日志中访问次数最多的前10IP 

#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 

#查看最近访问量最高的页面(.png) 

#cat access_log |awk '{print $7}'|grep '.png'|sort|uniq -c|sort -nr |head -n 10 

#查看日志中访问超过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 

#昨天访问网站的独立IP有多少; 

cat access_log|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq 

#统计某url,一天的访问次数 

#cat access_log|grep '12/Aug/2009'|grep '/images/index/e1.gif'|wc|awk '{print $1}' 

#拉出前五天的访问次数最多的网页前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 -100 

Guess you like

Origin blog.csdn.net/sunhuaqiang1/article/details/134080852