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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With