Posted By

level09 on 04/26/10


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Analyse Access Log, find most common ip addresses

 / Published in: Bash

we grab the 3rd column (using awk), we sort all the results, we then unique that output (-c gives us a count), and then sort numerically based on the count

we also sort ascending (-r) ... the head then gives us the top 20 IP addresses

  1. cat /path/to/log | awk '{print $3}' | sort | uniq -c | sort -rn | head -20

Report this snippet  

You need to login to post a comment.