Mass Reverse-DNS Lookup

September 4th, 2008 by Xerxes Leave a reply »

I needed to quickly browse through some web-server logs and pull out the hostnames which were accessing the web-server (to see where people were originating from).

The following single linux command will pull the IP address out of the apache log (for a particular date) and do the reverse DNS lookup for me:

cat access.log | grep ‘1/Sep’ | awk ‘{print $1}’ | sort | uniq | xargs -n1 host | grep -v ‘not found’

just in case i ever need it again….

Be Sociable, Share!

1 comment

  1. Interesting query. I am definately going to have to play around with that command.