How do I grep server access logs for unique IPs and a specific page?

grep, ip-address, logging

Solution

Assuming this is a standard Apache log, and assuming you are on Unix, I usually do

awk '{print $1}' access.log|sort -u

The awk filters out all IP addresses, the sort then removes duplicates.

To find out all accesses to a URL, I do

grep URL access.log

Of course, you will have to replace "URL" with the specific one you search for.

Problem

I want to grep my server logs to collect all of the unique IP Addresses, and also to see all of the requests for a specific page. What is the best way to do this?

Original source