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?
+5
A:
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.
Martin v. Löwis
2009-07-10 15:19:54