Nginx 日志 IP 统计
Today access.log
669 144.76.88.54 39 14.155.183.150 38 120.237.87.26 35 14.155.184.3 33 66.249.77.4 29 66.249.77.6 25 114.24.133.14 22 120.237.85.78 21 66.249.77.5 21 203.160.72.112 19 183.42.208.227 17 203.160.68.16 16 124.108.6.150 16 111.55.148.14 14 52.167.144.183 14 182.239.92.143 14 182.239.92.139 14 172.233.75.10 13 182.239.92.201 13 120.85.168.215
Yesterday access.log.1
7112 44.201.134.97 7110 158.220.105.45 6244 147.45.47.92 2510 167.172.106.24 1546 144.76.88.54 683 14.155.184.3 612 120.237.87.26 593 120.216.162.253 444 14.155.183.150 419 120.237.85.78 299 199.127.60.228 280 66.249.66.67 270 66.249.66.68 189 66.249.66.69 174 171.104.83.82 169 62.112.11.42 161 171.105.200.217 151 121.10.198.7 121 172.233.75.10 120 222.175.233.118
简介
统计 Nginx 日志(access.log)中的请求量排名前 20 的 IP。 方便判断是否有恶意 IP 请求,或者非正规搜索引擎的爬虫 IP。
Command
$ awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -n 20