Tag Archives: cat

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

Red Dwarf: Back to Earth

red-dwarf_first-shot_1000v2

The British comedy Red Dwarf has been a favorite of mine for many years, and this year it celebrates its 20th year anniversary.  While they show hasn’t *constantly* been in production this fact is a bit misleading, but regardless, this year the crew of The Cat, Rimmer, Lister and Kryten are reuniting for a new 3 part series, Back To Earth.