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.

Was wondering if there was a way to see which virtual host entry is used for routing a request? Is there some way to add the name of the virtual host file being used for the request to the access.log file?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

The LogFormat directive can take a %v placeholder which does exactly what you want.

The LogFormat options are documented here: http://httpd.apache.org/docs/2.2/logs.html#virtualhost

share|improve this answer
add comment

I find the Host: header to be very useful as well, add this to your LogFormat directive:

%{Host}i
share|improve this answer
    
They return different values, so depending on your scenario you may want both. %v returns the Servername of the vhost the request landed on. –  adaptr Mar 12 '12 at 16:17
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.