Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have an application which uses a DNS wildcard, i.e. * 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/

ServerAlias *
CustomLog "|/usr/sbin/vlogger -s access.log /var/log/apache2/vlogger" vlog

Clients access this application using their own URL, e.g.,, 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/ 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?

share|improve this question
Graeme, it's the same over here. 2 installs of apache 2.0.54 and 2.2, both configured with LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 2.0 shows the host header name (virtual host), 2.2 the host name. So it's not that you weren't right. BTW: Thanks for your "%{Host}i" :) – user125207 Jun 19 '12 at 14:36
up vote 2 down vote accepted

%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

%...v:          The canonical ServerName of the server serving the request.

share|improve this answer
Yeah, I saw those.... somehow both I and my colleague had convinced ourselves/each other that we'd always used %v. Looking at all the evidence against us it seems we are wrong. We've changed it to use %{Host}i now, which is probably what it was previously anyway. :-/ – ThatGraemeGuy Apr 21 '10 at 20:11

There is also %V (note the cap) and the useCanonicalName option

share|improve this answer
Thanks, but you're OT :) We were discussing how to log the (virtual host) name of the requested web site. – user125507 Jun 21 '12 at 11:15
...which is exactly what %V does. Logs the hostname of the virtual server which handled the request. The useCanonicalName option lets you control wether you want the server's opinion of it's name, or the client's opinion of the name. %{Host}i is always the client's opinion, so %V is another way to do that, plus a way to do what %{host}i cannot do. – Craig Constantine Jun 21 '12 at 14:49
This is the answer you were looking for, it's not OT. You were probably using the upcase %V and forgot. – Joey T Oct 30 '15 at 14:31

Your Answer


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.