Advertisement
fduran

Linux Apache IPs with most connections

Jul 19th, 2011
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. # www.fduran.com
  2. # Number of top 10 current TCP connections per IP
  3.  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
  4.  
  5. # Top 10 IPs in Apache log files
  6. 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement