0

I have an Apache 1.3 web server configured with several VirtualHost entries that serves multiple independent websites.

At certain times Apache receives a huge amount of request, which causes the server to reach a high workload. I would like to know which of all of these sites are receiving the requests.

How can I do that? I have read about Apache's mod_info module, but I do not know if it has security risks.

Thanks!

elitalon
  • 209
  • 5
  • 15

3 Answers3

3

My recommendation would be to alter your LogFormat to include %v, which is the ServerName of the <VirtualHost> serving the request.

From there, analysis of the logs will allow you to determine where the majority of the requests are coming in to.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • In this particular case I already have a separated log for each site. But it's a nice alternative too – elitalon Oct 18 '11 at 06:01
1

If you have one log file for each domain e.g. /var/log/apache/domain.tld/access_log

Then you could use watch, sort and du to find out which file changes most rapidly (as apache always adds things to logfiles)

# watch "du -k /var/log/apache/*/access_log |sort -n"

Or if you have a lot of files and you are only interested in thost changing the most

# watch "du -k /var/log/apache/*/access_log |sort -n |tail -30"
Frands Hansen
  • 4,657
  • 1
  • 17
  • 29
0

You can log the hostname requested with:

%{Host}i

You can log the ServerName of the VirtualHost with:

%v
r_2
  • 335
  • 3
  • 9