Skip to content

Instantly share code, notes, and snippets.

@esmiz
Forked from fduran/gist:1870507
Created October 1, 2017 09:10
Show Gist options
  • Save esmiz/9f50ff866ca75b9f68ad53d5eea78254 to your computer and use it in GitHub Desktop.
Save esmiz/9f50ff866ca75b9f68ad53d5eea78254 to your computer and use it in GitHub Desktop.
Apache find IPs with most connections
# www.fduran.com
# Number of top 10 current TCP connections per IP
netstat -tan| grep -v 'LISTEN'| awk '{print $5}'| grep -v 'and' |grep -v 'Address' |cut -d':' -f1 |sort -n | uniq -c | sort -rn | head -n10
# Top 10 IPs in Apache log files
cd /var/log/apache2; for i in ./access.log*; do echo $i; cat $i | awk '{print $1}'| sort -n | uniq -c | sort -rn | head -n10; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment