Count and sort IP addresses in Nginx access logs

Posted on April 5, 2020 at 11:46 am

You can count and sort IP addresses in Nginx access logs:

cat access.log | awk '{print $1}' | sort | uniq -c | sort -nr

Below there is an example output:

    612 216.X.X.X
    251 54.X.X.X
    238 18.X.X.X
    147 178.X.X.X
    138 106.X.X.X
     78 79.X.X.X
     64 180.X.X.X
     58 217.X.X.X
     52 72.X.X.X
     48 196.X.X.X
     38 146.X.X.X
     34 207.X.X.X

Receive updates via email

Other Posts

Updated Posts