Nginx Log Top IP

Today access.log

    567 66.249.66.69
    469 146.70.189.115
    451 66.249.66.70
    311 66.249.66.71
    232 27.46.125.240
    221 14.153.240.187
    212 14.155.227.149
    192 117.132.188.205
    135 14.155.189.96
     87 100.2.149.48
     78 216.244.66.241
     62 81.70.135.13
     58 39.144.251.128
     56 117.132.188.204
     50 205.134.180.185
     49 78.153.140.179
     46 45.64.125.168
     44 8.216.86.166
     44 167.71.239.146
     36 205.134.180.166

Yesterday access.log.1

   1354 66.249.73.203
   1111 66.249.73.204
    778 66.249.73.205
    681 27.46.125.240
    588 185.49.126.234
    535 14.155.227.149
    473 141.98.10.151
    406 14.153.238.82
    313 216.244.66.241
    307 14.155.189.96
    292 66.249.66.69
    276 66.249.66.70
    220 121.10.198.7
    207 66.249.66.71
    207 65.108.46.72
    177 159.138.143.38
    172 223.64.28.165
    160 205.134.180.185
    155 14.155.209.59
    138 135.181.79.106

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