Forum Moderators: phranque

Message Too Old, No Replies

customlog in httpd.conf

         

quali74

4:08 pm on Apr 21, 2009 (gmt 0)

10+ Year Member



Hello

I have the following lines in my htttp.conf


<VirtualHost *:80>
DocumentRoot "web/site1"
ServerName www.site1.co.uk
ServerAlias preview.site1.co.uk
ServerAlias www.site2.com
ServerAlias preview.site2.com
ServerAlias www.site3.com
ServerAlias preview.site3.com
ErrorLog logs/www.site1.co.uk-error_log
CustomLog logs/www.site1.co.uk-access_log common
</VirtualHost>

This virtualhost manages 3 different websites managed by a DB.

I want to use webalizer to see the traffic that is going to my different sites: site1, site2 and site3.
I think I need to generate many custom logs but I have no idea of how it can be done...

Also I changed the Logformat in www.site1.co.uk-access_log and displayed %v . To my surprise, it displayed www.site1.co.uk instead of the address of the site I went to (www.site2.com)

please help

jdMorgan

2:40 am on Apr 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



About the only thing I'm comfortable recommending here is that you probably want to use %{Host}i instead of %v as the logging token.

See the examples in Apache mod_log_config [httpd.apache.org].

You can enable custom logging per-site by using the "env=[!]environment-variable" syntax of the CustomLog directive. The necessary per-site environment variables can be set based on the Host header, using the SetEnvIf directive (see Apache core directives).

It might be simpler to define separate vHosts for the sites that are not true 'copies' of each other, in order to make this logging simpler (and possibly simplify other functions as well) -- Nothing says you can't still point them all to the same DocumentRoot to avoid messing up your CMS.

Jim