Nginx Log Top IP
Today access.log
2801 216.73.216.196 1138 43.156.79.172 1046 43.156.232.154 1043 43.165.129.89 1019 43.134.163.229 998 43.134.93.164 641 103.148.104.73 332 113.2.166.130 309 139.205.52.173 244 185.177.72.204 206 66.249.79.236 179 66.249.79.237 175 66.249.79.238 141 182.39.45.2 133 39.144.168.102 130 172.233.75.10 116 210.16.67.178 113 14.153.240.46 113 115.45.43.10 110 14.153.234.76
Yesterday access.log.1
1183 43.165.129.89 1158 43.134.93.164 1122 43.156.79.172 1099 43.134.163.229 1068 43.156.232.154 332 113.2.166.123 213 42.51.33.240 185 183.219.114.223 176 106.55.200.45 175 39.144.146.81 147 14.155.225.135 144 14.153.240.208 143 116.76.38.89 142 66.249.75.37 137 172.233.75.10 136 216.244.66.241 135 140.75.154.152 135 111.221.213.19 134 116.76.39.29 133 14.153.219.157
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