Shell statistics web log Client ip sorting

Source: Internet
Author: User
All # linuxapachenginxawk {a [$1] a [$1] + $10} END {for (iina) printa [I] 10241024 MB, I} access. log | sort-nrip_tarffic_bbs.linuxtone.org.20110114 # iisawk {a [$7] a [$7] + $ NF} END {for (iina) printa [I] 10241024 MB, I} access. log | sort-nr

All # linux apache nginx awk '{a [$1] = a [$1] + $10} END {for (I in) 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) print a [I]/1024/1024 "MB", I} 'access. log | sort-nr

All

  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

Specific time period

  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

Count application traffic

# Linux apache nginx
Awk '{print $7}' access. log | sort | uniq-c | sort-nr | head-10

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.