(summary) A shell that counts the number of independent IP accesses in Apache or Nginx access logs

Source: Internet
Author: User

1, the number of IP direct output display:
cat access_log_2011_06_26.log |awk ‘{print $1}‘|uniq -c|wc -l

2, the number of IP output to the text display:
cat access_log_2011_06_26.log |awk ‘{print $1}‘|uniq -c|wc -l > ip.txt

Summary: If a single access log is larger than 2G, the system load will rise when viewed with this command, so do not view when the server is under high load, preferably in a low load time period. The above is one of the company's advertising server a day of IP access, which actually includes the search engine. Access logs can only be a reference, to be accurate or to be counted by the program.


Cat Access_log_2011_06_26.log |awk ' {print $} ' can be changed to
awk ' {print '} ' Access_log_2011_06_26.log

This saves resources and is faster




(summary) A shell that counts the number of independent IP accesses in Apache or Nginx access logs

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.