Mass Reverse-DNS Lookup

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….

1 comment

Leave a Reply

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