Nginx Log Top IP
Today access.log
517 43.165.129.89 462 43.134.93.164 439 43.134.163.229 434 43.156.232.154 406 43.156.79.172 202 206.119.174.32 162 66.249.79.236 136 66.249.79.238 113 66.249.79.237 73 216.244.66.241 60 91.201.115.242 60 39.144.146.85 52 43.173.1.69 51 106.56.105.103 48 54.37.252.137 48 36.37.164.108 46 112.12.236.244 43 222.195.81.59 38 8.29.198.26 37 43.153.204.189
Yesterday access.log.1
1140 43.156.232.154 1111 43.165.129.89 1095 43.156.79.172 1087 43.134.93.164 1056 43.134.163.229 372 62.197.157.40 314 155.2.192.170 300 158.220.123.113 248 94.154.239.69 213 106.56.105.103 183 66.249.79.236 178 43.173.1.57 170 43.153.204.189 166 43.173.1.69 163 43.156.232.190 162 66.249.79.237 152 66.249.79.238 149 43.134.186.61 148 43.133.139.6 142 147.135.252.177
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