Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

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"
share|improve this answer
add comment

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.

share|improve this answer
    
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 6:01
add comment

You can log the hostname requested with:

%{Host}i

You can log the ServerName of the VirtualHost with:

%v
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.