Nginx Log Top IP

Today access.log

     70 66.249.66.69
     66 66.249.66.70
     49 78.153.140.179
     45 66.249.66.71
     23 39.144.75.148
     19 119.133.246.66
     18 221.132.33.169
     16 14.155.227.149
     13 216.244.66.241
     12 81.70.135.13
     12 58.252.137.58
     10 27.46.125.240
      8 223.73.113.201
      8 205.134.180.185
      7 14.153.240.187
      6 157.55.39.15
      6 112.96.47.86
      5 223.104.77.149
      5 207.46.13.111
      5 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