Nginx Log Top IP
Today access.log
300 194.247.173.99 248 178.18.254.165 141 45.125.66.108 107 192.99.37.132 96 116.23.26.43 80 119.129.224.249 61 216.244.66.241 50 212.34.135.52 43 151.5.89.142 40 119.129.225.144 39 66.249.75.37 36 183.221.230.105 34 66.249.75.38 31 106.55.200.233 28 3.15.6.156 28 172.233.75.10 28 119.131.219.33 27 118.123.1.36 24 14.155.230.119 24 14.153.240.26
Yesterday access.log.1
821 112.49.131.157 349 183.47.105.49 232 216.244.66.241 220 106.55.200.45 218 81.71.5.172 213 106.117.76.95 207 66.249.73.237 198 66.249.73.236 195 121.10.198.7 188 66.249.73.238 178 36.238.118.193 168 223.99.125.94 156 111.33.2.83 148 222.175.233.118 142 122.244.51.225 139 14.155.189.36 130 172.233.75.10 128 119.146.59.58 120 14.153.234.78 117 14.155.230.119
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