shell统计web日志客户端ip排序
时间:2021-07-01 10:21:17
帮助过:42人阅读
全部 #linux apache nginx awk '{a[$1]=a[$1]+$10}END{for(i in a)print a[i]/1024/1024"MB",i}' access.log|sort -nr ip_tarffic_bbs.linuxtone.org.20110114 #iis awk '{a[$7]=a[$7]+$NF}END{for(i in a)print a[i]/1024/1024"MB",i}' access.log|sort -nr
全部
- #linux apache nginx
- awk '{a[$1]=a[$1]+$10}END{for(i in a)print
a[i]/1024/1024"MB",i}' access.log|sort -nr
>ip_tarffic_bbs.linuxtone.org.20110114
- #iis
- awk '{a[$7]=a[$7]+$NF}END{for(i in a)print
a[i]/1024/1024"MB",i}' access.log|sort -nr
>ip_tarffic_bbs.linuxtone.org.20110114
特定时间段
- #linux apache nginx
- sed -n
'/\[13\/Jan\/2011\:16\:00\:00/,/\[13\/Jan\/2011\:19\:00\:00/p'
access.log|awk '{a[$1]=a[$1]+$10}END{for(i in
a)print a[i]/1024/1024"MB",i}' |sort -nr
>ip_tarffic_bbs.linuxtone.org.20110114_16-18
- #iis
- sed -n '/16\:00\:00/,/19\:00\:00/p'
access.log|awk '{a[$7]=a[$7]+$NF}END{for(i in
a)print a[i]/1024/1024"MB",i}' |sort -nr
>ip_tarffic_bbs.linuxtone.org.20110114_16-18
统计应用访问量
#linux apache nginx
awk '{print $7}' access.log |sort|uniq -c|sort -nr|head -10