3

I am running Apache server and would like to find out who (IP address) is making a lot of request for the last 24 hours using command line. Also like to find out who has the most open connection at the moment?

user965363
  • 743
  • 2
  • 6
  • 11

2 Answers2

5

I am running Apache server and would like to find out who (IP address) is making a lot of request for the last 24 hours using command line.

awk '/29\/Sep\/2011/ { print $1 }' /path/to/access_log | sort | uniq -c | sort -rn | head

Also like to find out who has the most open connection at the moment?

netstat -natp | grep httpd | awk '{ print $5 }' | cut -d: -f1 | sort | uniq -c | sort -rn | head
quanta
  • 51,413
  • 19
  • 159
  • 217
0

You can use tail /path/to/apache_log_file (check in /var/log/apache2). One way to see current connections is to use mod_status. You can also use netstat -a |grep www

xofer
  • 3,072
  • 12
  • 19