Apache access log count IP addresses

Simple one liner:

cat access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20

And if needed, you can block some IP addresses in ufw firewall like this

root@vmware:/# ufw insert 1 deny from 12.12.12.12
Rule inserted

See https://phpsolved.com/ubuntu-ufw-firewall-installation/

Write a Comment

Comment