MARCH 10, 2015

Show number of requests made by different IPs, by analysing nginx log

Here's a small command that uses awk, sort and uniq to see the number of requests made to an nginx server, aggregated by IP, and sorted by the number of requests made.

tail -n 300000 /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -n

Can be useful to see who is crawling your website. The tail's -n parameter specifies how many of the last rows to look at, and can of course be tweaked.

Comments

ABOUT ME

Jonatan Heyman My name is Jonatan Heyman, and I'm a programmer. On this blog I write about programming, the web and technology. I also listen to a large number of indie pop tunes. You can read more about me on the about page.

TAGS

MY LATEST TWEETS

Copyright (c) 2009-2010 Jonatan Heyman