Logging domain of http requests in apache

paullb asked:

looking at httpd’s access log and I see requests but they all start at “/”.

I have a few ServerAliases set up. Is there any way to see what domain (subdomain) the requests are coming in to?

My answer:


Apache doesn’t log the hostname by default, though you can change your Apache log format to log it. I prefer to log it in the otherwise useless second field, for example:

LogFormat "%h %{Host}i %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.