Getting unique IP addresses from Apache logs

I always want to do this, and I always forget how, so now I’m writing it down here so I can always look it up whenever I need it.

This is a really simple way to get a list of unique IP addresses from an Apache (or Apache-like) log file:

grep -i [search] [filename] | awk '{ print $1 }' | sort | uniq

Leave a Reply

Your email address will not be published. Required fields are marked *