We have an application which uses a DNS wildcard, i.e. *.app.example.com. We're using Apache 2.2 on Ubuntu Hardy. The relevant parts of the Apache config are as follows.
In /etc/apache2/httpd.conf:
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vlog
In /etc/apache2/sites-enabled/app.example.com:
ServerName app.example.com
ServerAlias *.app.example.com
...
CustomLog "|/usr/sbin/vlogger -s access.log /var/log/apache2/vlogger" vlog
Clients access this application using their own URL, e.g. company1.app.example.com, company2.app.example.com, etc.
Previously, the %v
in the LogFormat
directive would match the hostname of the client request, and we'd get several subdirectories under /var/log/apache2/vlogger corresponding to the various client URLs in use.
Now, %v
appears to be matching the ServerName
value, so we only get one log under /var/log/apache2/vlogger/app.example.com. This breaks our logfile analysis because the log file has no indication of which client the log relates to.
I can fix this easily by changing the LogFormat
to this:
LogFormat "%{Host}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vlog
This will use the HTTP Host: header to tell vlogger which subdirectory to create the logs in and everything will be fine.
The only concern I have is that this has worked in the past and I can't find any indication that this has changed recently.
Is anyone else using a similar config, i.e. wildcard + vlogger and using %v
? Is it working fine?
There is also %V (note the cap) and the useCanonicalName option
%v is and always has been the canonical name of the vserver, ive just checked the manuals for both 1.3, 2.0 and 2.2 and they all say
https://httpd.apache.org/docs/1.3/mod/mod_log_config.html
https://httpd.apache.org/docs/2.0/mod/mod_log_config.html
https://httpd.apache.org/docs/2.2/mod/mod_log_config.html