So you want to know how many different ip’s have been hitting your apache server?


It’s simple to do first locate your logs normally in /var/log/httpd/access_log (redhat)


Look at the log and identify which field is the ip address in ours it’s the first entry so we will use $1 (if it’s the second replace with $2)


cat /var/log/httpd/access_log | awk ‘{print $1}’ | sort | uniq | wc -l


This will output a count of unique hits.  You can also get a list with:

cat /var/log/httpd/access_log | awk ‘{print $1}’ | sort | uniq


© 2012, Joseph Griffiths. All rights reserved.

Leave a Reply