Nginx Log Top IP
Today access.log
2107 180.114.153.241 202 216.73.216.216 60 216.73.216.130 54 216.244.66.241 34 106.56.105.103 27 66.249.73.197 27 121.10.198.7 25 66.249.73.199 25 66.249.73.198 21 14.216.163.148 20 58.212.116.187 18 183.208.199.100 16 106.60.150.176 14 172.233.75.10 14 117.72.126.131 12 66.249.79.236 12 222.210.161.4 11 157.55.39.49 10 40.77.167.7 10 163.125.240.251
Yesterday access.log.1
32823 180.114.153.241 641 103.66.218.182 616 216.244.66.241 582 52.169.26.33 582 52.138.214.36 582 13.74.42.55 371 123.181.234.165 367 66.249.79.236 322 106.56.105.103 314 136.243.228.195 305 66.249.79.237 247 66.249.79.238 246 113.200.149.34 193 117.132.188.205 185 120.230.234.120 177 114.95.111.36 177 111.240.103.216 159 185.177.72.144 153 111.33.2.83 147 72.14.199.236
Introduction
Statistics for Nginx based on the access.log file: Count the number of unique IP addresses. Determine whether each IP is allowed or denied based on the request, and provide details on any blocked IPs.
Command
$ awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -n 20