日志信息
127.0.0.1 - - [20/Jan/2015:10:54:02 +0800] "GET / HTTP/1.1" 200 20808 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
127.0.0.1 - - [20/Jan/2015:10:54:03 +0800] "GET /favicon.ico HTTP/1.1" 404 151 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
127.0.0.1 - - [20/Jan/2015:10:54:15 +0800] "GET /index.php HTTP/1.1" 200 20806 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
127.0.0.1 - - [20/Jan/2015:10:54:23 +0800] "GET /index.html HTTP/1.1" 404 151 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
127.0.0.1 - - [20/Jan/2015:10:56:08 +0800] "GET /index.html HTTP/1.1" 200 45 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
127.0.0.1 - - [20/Jan/2015:11:31:33 +0800] "GET / HTTP/1.1" 200 45 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:11:55:11 +0800] "GET / HTTP/1.1" 200 45 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:11:55:11 +0800] "GET /favicon.ico HTTP/1.1" 404 151 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:11:55:11 +0800] "GET /favicon.ico HTTP/1.1" 404 151 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:11:55:15 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:11:55:16 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:11:55:17 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:12:14:44 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
192.168.60.200 - - [20/Jan/2015:12:14:45 +0800] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
使用以下命令即可统计出访问网页最多的5名的ip
cat nginx.log | awk '{print$1}' |sort|uniq -c|sort -rn|head -5
效果
8 192.168.60.200
6 127.0.0.1