Search http logs for unique IP addresses

I recently neeeded to whitelist some IP’s from my apache server.

What I wanted to do is grep my access log (/etc/httpd/logs) for a list of IP addresses that are accessing my application.

I cam up with:

grep "" .log | cut -c 1-10 | uniq

So this was possible because i wanted to find only people who were actually accessing my URI’s so i picked something to grep for that was in the base URI of my app.

Share