Subdomain Logging on wildcard ServerAlias in VirtualHost

I have a service that offers members their own unique subdomain - ie.

Although each members web page is customized based on the unique member_name they all point to the same directory - ie. and all point to the same directory.

Here is how my VirtualHost is setup for this domain:

<VirtualHost XXX.XXX.XXX.X:16080>
     ServerAlias *
     DocumentRoot "/Library/WebServer/Documents/"
     DirectoryIndex "index.html" "index.lasso" "index.php"
     CustomLog "/var/log/httpd/access_log" "%v %{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
     ErrorLog "/var/log/httpd/error_log"
     LogLevel warn

Everything is working fine on the serve side however my problem lies in how I can seperate up logging for each individual member.

With this current setup all requests are being logged with %v set to and not

I need to figure out a way to log the subdomain so I can then split up the log file to offer each of my members individual statistics.

Also I have many other VirtualHosts set up on this server so using a global mod_vhost_alias with VirtualDocumentRoot is not an option.
Who is Participating?
ahoffmannConnect With a Mentor Commented:
stolen from

%...v:          The canonical ServerName of the server serving the request.
%...V:          The server name according to the UseCanonicalName setting.
you need to use mod_setenv to set a (internal) variable containing the hostname, then use it in the LogFormat/Custom_Log string, something like (to be improved inmany ways):

SetenvIf HTTP_HOST membername=%{HTTP_HOST}
CustomLog "/var/log/httpd/access_log" "%{membername}e ...."
nextkidAuthor Commented:
I seem to have fixed this by simply changing the lowercase v in the referrer to an uppercase V. Is this correct behavior? What is the technical difference between the two?
All Courses

From novice to tech pro — start learning today.