HOWTO sort web-server logs to find top users

The other day I came across a situation where a web-server was getting hammered, and we needed to know who the offend(ers) were. While watching a logfile tail by at high speeds is always fun, we wanted to be able to sort the web-server access log and find top users, to be able to narrow down where the traffic was coming from. While we don’t want to block users that want to access our data, sometimes we need to throttle things back so one requester doesn’t overwhelm all the available bandwidth and make the site unusable for others. So after some playing around and digging on Google, we came up with a nice, succinct one liner to do this, here it is:

cat /path/to/access.log | awk '{print $1}' | sort | uniq -c | sort -n | tail

Recently it seems that piping cat output to other apps is all I do on my servers, and I’m ok with that!




  • Anonymous

    YOU POSTED…YOU WROTE…YOU LIVE!!!!
    What a good day.
    Too bad i don’t understand any of this…NEVERTHELESS…Welcome back!

  • matt1912

    YOU POSTED…YOU WROTE…YOU LIVE!!!! What a good day.Too bad i don't understand any of this…NEVERTHELESS…Welcome back!

  • http://www.titidirectonline.co.uk/mobile-phones Dual Sim Phone

    great read

  • http://www.google.com Dual Sim Phone

    great read

  • http://www.titidirectonline.co.uk/mobile-phones Dual Sim Phone

    great read

Read previous post:
Tea partiers: You get mad now?

Since the health-care debate brought out the worst in the tea party protesters, we've seen a shift from fear mongering, [...]

Close