Old boy Education Daily-April 26, 2017-count the number of IP and per-address accesses by accessing the log Access.log

Source: Internet
Author: User

Count the number of IP and per-address accesses through the access log Access.log

101.226.61.184 - - [22/nov/2015:11:02:00 +0800]  "Get /mobile/sea-modules/gallery /zepto/1.1.3/zepto.js http/1.1 " 200 24662 " http://m.oldboyedu.com/mobile/theme/oldboyedu/ Home/index.html " " mozilla/5.0  (linux; u; android 5.1.1; zh-cn; huawei  crr-ul00 build/huaweicrr-ul00)  AppleWebKit/533.1  (Khtml, like gecko) version/4.0  mqqbrowser/5.4 tbs/025478 mobile safari/533.1 micromessenger/6.3.7.51_rbb7fa12.660  NETTYPE/3GNET LANGUAGE/ZH_CN "101.226.61.184 - - [22/nov/2015:11:02:00 +0800] " get /mobile/theme/oldboyedu/common/js/baiduanalytics.js http/1.1 " 200 526 "/http M.oldboyedu.com/mobile/theme/oldboyedu/home/index.html " " mozilla/5.0  (linux; u; android  5.1.1; zh-cn; huawei crr-ul00 build/huaweicrr-ul00)  AppleWebKit/533.1  ( Khtml, like geCKO) version/4.0 mqqbrowser/5.4 tbs/025478 mobile safari/533.1 micromessenger/6.3.7.51 _RBB7FA12.660 NETTYPE/3GNET LANGUAGE/ZH_CN "

Method 1:

awk ' {s[$1]++}end{for (i in s) print S[i],i} ' access.log |sort-rn5 101.226.61.1842 27.154.190.1582 218.79.64.761 114.94. 29.165


Method 2:

awk ' {print '} ' access.log |sort|uniq-c|sort-rn 5 101.226.61.184 2 27.154.190.158 2 218.79.64.76 1 114.94.29.165

The awk array is not quite understood yet?

Previous issue:awk Array Statistics

Previous topic:awk Cumulative Additions

Frequently asked Questions: Beginner awk arrays will encounter several common problems


today is a day to accompany everyone's first day, look forward to your progress.

For questions and answers, please leave a comment in the blog comments section.

Index of the topic of the previous period

http://lidao.blog.51cto.com/3388056/1914205



This article is from the "Lee blog" blog, make sure to keep this source http://lidao.blog.51cto.com/3388056/1919766

Old boy Education Daily-April 26, 2017-count the number of IP and per-address accesses by accessing the log Access.log

Related Article

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.