Is there a shell command to group all the most common IPs that requested a specific file via GET (or that came from a url)?
For example with this command I can group requests from ip:
cat /usr/local/apache/logs/access_log | awk '{print $1}' | sort | uniq -c | sort -n | tail -n 20
With this one I can search for "MYURL"
grep 'MYURL' /usr/local/apache/logs/access_log | sort -nr | uniq -c | sort -nr -k1 | tail -n 20
What I need is to put these 2 commands together and print the most common IPs that requested "MYURL", is that possible?
PS: also it would be nice if the log used is "/usr/local/apache/logs/error_log" and not "access_log"