Quickly get count stats of visitors on Apache2 access log file using awk

To get a count on the last most hit VHosts on your Apache server:

replace (-10000) with however much you want to go back

tail -10000 /var/log/apache2/access.log | awk -F ‘”‘ ‘{print $4}’ | awk -F ‘/’ ‘{print $3}’ | sort | uniq -c

To Get a Count on all the IPs that hit your server in the past X tail

tail -10000 /var/log/apache2/access.log | awk -F ‘-‘ ‘{print $1 }’ | sort | uniq -c

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top