Nginx Log Top IP

Today access.log

    578 13.74.42.55
    384 81.209.177.145
    375 216.244.66.241
    221 220.185.158.162
    207 216.73.216.164
    193 117.132.188.205
    173 66.249.79.236
    168 114.95.111.36
    151 66.249.79.238
    146 66.249.79.237
    144 124.108.6.154
    142 172.190.142.176
    142 138.91.62.148
    120 14.216.166.244
    115 106.56.105.103
    103 39.144.168.68
     92 125.67.184.67
     90 172.233.75.10
     84 175.24.248.85
     78 59.175.155.161

Yesterday access.log.1

   1179 216.73.216.199
    602 136.243.228.195
    590 52.138.214.36
    555 216.73.216.75
    524 52.178.128.237
    512 13.79.54.207
    510 171.105.201.184
    494 216.244.66.241
    485 122.5.15.214
    346 40.87.142.201
    322 66.249.79.236
    299 171.105.208.129
    292 106.56.105.103
    250 220.185.158.162
    249 20.171.207.7
    232 66.249.79.237
    221 121.10.198.7
    192 66.249.79.238
    148 119.130.152.46
    142 40.69.222.66

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