I have seen someone use this command -- and it works where it pulls back all the IPS in a list/group:

cat access.* | awk '{ print $1 }' | sort | uniq -c | sort -n

However, I want to choose the past 2 days; how can I do that?

  • so before issuing the above coomand u need to filter the access log and get the entries for last two days , and pipe the output to the above command , to get the entries in a timespan see this stackoverflow.com/questions/7706095/… – Ijaz Ahmad Khan Jul 13 '16 at 22:56

tail -100 access.* | awk '{ print $1 }' | sort | uniq -c | sort -n


cat access.* | grep "28/Mar/2016" | awk '{ print $1 }' | sort | uniq -c | sort -n

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.