Number of IP occurrences in the statistics log

Source: Internet
Author: User

Grep-r ' get/weixin/weixin_izp/index.html './chunyun.access.log > ~/access.log cat access.log |awk ' {print $} ' |cut-d  ,-f3|sort|uniq-c > Mycount.log 1. To extract the most visited IP, you need to first extract the IP segment from the log.  $ cat Aa.txt |awk-f "" ' {print $ {} ' 127.0.0.1 192.168.1.100 192.168.1.100 192.168.1.100 (PS, also available here with the Cut command.) $ cut-d ""-F 1 aa.txt 127.0.0.1 192.168.1.100 192.168.1.100 192.168.1.100) 2. Count IP to see how many times each IP has appeared $ cat aa.txt |awk-f "' {print '} ' |uniq-c 1 127.0.0.1 3 192.168.1.100 (Ps:wc-l can also count the number of rows, but the overall count is total, all rows.)    Not classified statistics) 3. By IP occurrences from large to small $ cat aa.txt |awk-f "" ' {print $} ' |uniq-c |sort-r 3 192.168.1.100 1 127.0.0.1 Sort | uniq-c | Sort-nr | Head-10
Is the basic usage of counting the duplicate rows and listing the maximum number of repetitions of N Records

Number of IP occurrences in the statistics log

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.