Include requested hostname in access_log

Posted by Aaron J Spetner on Server Fault See other posts from Server Fault or by Aaron J Spetner
Published on 2012-06-02T19:40:48Z Indexed on 2012/06/02 22:43 UTC
Read the original article Hit count: 270

Filed under:

I would like my access_log to list the host name that the client is requesting (e.g. when requesting http://www.example.com/test I should see "www.example.com" in the log). The only thing I have found so far is to use %v in the LogFormat directive, but this only gives "the canonical ServerName of the server serving the request" (as described by Apache at http://httpd.apache.org/docs/2.0/mod/mod_log_config.html#formats). This does not help me for requests that use a hostname that is not specified in a ServerName directive.

Is there any way to log the requested hostname?

Thanks

© Server Fault or respective owner

Related posts about apache2