3

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?

7

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

2

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

%{Host}i
1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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