Home >Database >Mysql Tutorial >shell 统计web日志 客户端ip 排序

shell 统计web日志 客户端ip 排序

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:30:581236browse

全部 #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

全部

  1. #linux apache nginx
  2. 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
  3. #iis
  4. 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

特定时间段

  1. #linux apache nginx
  2. 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
  3. #iis
  4. 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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn