日期:2014-05-16  浏览次数:20891 次

access_log查看方法

1 access_log.1 昨天一天的点击量(clicks);
ACCESS_LOG.1
[httpd@test log]$ cat access_log.1|grep '12/Aug/2009'|grep "******.jsp"|wc|awk '{print $1}'|uniq
17439

2 昨天访问网站的独立IP有多少;
ACCESS_LOG.1
[httpd@test log]$ cat access_log.1|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq???
1172112
ACCESS_LOG.2
[httpd@test log]$ cat access_log.2|grep '12/Aug/2009'|grep ******"|wc|awk '{print $1}'|uniq
9124

3 访问次数最多的IP前十名清单;
ACCESS_LOG.1
[httpd@test log]$ cat access_log.1|grep "******.jsp"|awk '{print $1}'|uniq -c|sort -n -r |head -n 10


4 统一某url,一天的访问次数; echo “11/Aug/2009 logo click (first number) ”
ACCESS_LOG.1
[httpd@test log]$ cat access_log.1|grep '12/Aug/2009'|grep '/images/index/e1.gif'|wc|awk '{print $1}'


5 昨天有多少个IP访问了某个页面;
[httpd@test log]$ cat access_log.1 |grep "******.jsp"|awk '{print $1}'|sort|uniq|wc
???1808????1808???25732


6 访问次数最多的网页(.htm ,html,jsp或url 如 show.jsp?info_id=755)前20名清单;
[httpd@test log]$ cat access_log.1|grep "******.jsp"|awk '{print $1}'|uniq -c|head -n 20|sort -n -r


7 拉出前五天的访问次数最多的网页前20名清单;进行五天日志对比,找出排名靠前重复的网页,即可得出本周访问量最大的前几个网页;
[httpd@test log]$ cat access_log.1|awk '{print $8}'|uniq -c |sort -n -r|head -20


8,因web使用了squid cache, 按TCP_MEM_HIT,这种方式进行排列,次数最多的排名靠前,即统计命中率情况;
[httpd@test log]$ cat access_log.1|grep 'TCP_MEM_HIT'|awk '{print $4}'|uniq|head -20 |sort -n -r
TCP_MEM_HIT:NONE

9,当前WEB服务器中联接次数最多的ip地址:
[httpd@test log]$ netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r?

10,当前WEB服务器中访问次数最多的页面(.swf)

[root@www?logs]#?cat?access_log.20091012|awk?'{print?$8}'|grep?'.swf'|sort|uniq?-c|sort?-nr?|head?-n?10