Solved

Subdomain Logging on wildcard ServerAlias in VirtualHost

Posted on 2004-08-03
4
1,423 Views
Last Modified: 2009-06-26
I have a service that offers members their own unique subdomain - ie. http://member_name.mydomain.com

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

Here is how my VirtualHost is setup for this domain:

<VirtualHost XXX.XXX.XXX.X:16080>
     ServerName mydomain.com
     ServerAlias *.mydomain.com
     ServerAdmin email_addy@mydomain.com
     DocumentRoot "/Library/WebServer/Documents/mydomain.com"
     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
</VirtualHost>

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 mydomain.com and not member_name.mydomain.com

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.
0
Comment
Question by:nextkid
  • 2
4 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11713970
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 ...."
0
 

Author Comment

by:nextkid
ID: 11913877
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?
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 11984038
stolen from http://httpd.apache.org/docs/mod/mod_log_config.html#formats

%...v:          The canonical ServerName of the server serving the request.
%...V:          The server name according to the UseCanonicalName setting.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now