httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Christophe Montigny <...@assoces.com>
Subject Re: [users@httpd] Wildcard DNS with Separate Subdomain Log Files
Date Fri, 27 May 2005 12:09:43 GMT
Nonono

You need a cron job that will run the command :

cat access.log | /path/to/split-logfile

it will create the logfiles to the directory where split-logfile is stored.

You may want to edit the script a little so it outputs the logfiles to a 
given directory.

You merely need to change the CustomLog directive in your httpd.conf
from
CustomLog /var/log/apache/access.log combined

to
CustomLog /var/log/apache/access.log vhost

knowing that you have the LogFormat directive :
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" 
\"%{forensic-id}n\"" vhost


Ben Fryer wrote:

> Hi Jean
>
> Thank you great answer, just what I was looking for!
>
> One final question ;) can I just check how I should use split-logfile
>
> CustomLog "|/apache/split-logfile >> /path/to/user/logs/access_log" vhost
>
> Something like that?
>
> Thanks again
>
> Ben
>
> ----- Original Message ----- From: "Jean-Christophe Montigny" 
> <jcm@assoces.com>
> To: <users@httpd.apache.org>
> Sent: Friday, May 27, 2005 12:30 PM
> Subject: Re: [users@httpd] Wildcard DNS with Separate Subdomain Log Files
>
>
>> Hello,
>>
>> Just add a new definition of log format possibly called "vhost" : 
>> copy the "combined" log format and add a %h at the beginning of the 
>> definition.
>> %h stands for "virtual host name".
>>
>> Everything will be logged to the regular access.log except the log 
>> lines will look like :
>> user1.mydomain.com 10.10.10.10 <time> <accessed page> ...
>>
>> split-logfile will the,n parse that file and write into new files 
>> called user1.mydomain.com.log :
>> 10.10.10.10 <time> <access page> ....
>>
>> Those files can then be parsed by webalizer.
>>
>> That's what i'm doing, it's working fine. The only con is that when 
>> run by a cron job, it will add lines that already exist to the vhost 
>> logfiles, making
>> them a lot bigger.You may want to delete logfiles before using 
>> split-logfile so that you don't end up with tons of redundant logfiles.
>>
>> *subliminal message*logfile*
>>
>> Hope that helps,
>>
>> Jean-Christophe Montigny
>>
>> Ben Fryer wrote:
>>
>>> Hi All
>>>
>>> We have apache configured using wildcard DNS *.mydomain.com
>>>
>>> The site has members who on sign up can instantly access their 
>>> version of the site.
>>>
>>> user1.mydomain.com
>>> user2.mydomain.com
>>> ...
>>>
>>> We use a single VirtualHost definition that captures *.mydomain.com 
>>> rewrites to a script that extracts the username displays the correct 
>>> site.
>>>
>>> That all works fine!
>>>
>>> The problem we have is we now want too provide users stats for their 
>>> subdomains using a web stats application such as webalizer, ideally 
>>> having a separate log file for each subdomain.
>>>
>>> Is there any way we could get apache to automatically produce 
>>> multiple log files for each sub domain in the same VirtualHost 
>>> definition effectively:
>>>
>>> CustomLog /logs/www.mydomain.com_access_log combined
>>> CustomLog /logs/user1.mydomain.com_access_log combined
>>> CustomLog /logs/user2.mydomain.com_access_log combined
>>> ...
>>>
>>> There is a mention of a script called split-logfile in the manual 
>>> but its not very clear how it can be used.
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Many Thanks
>>>
>>> Ben
>>>
>>> ---------------------------------------------------------------------
>>> The official User-To-User support forum of the Apache HTTP Server 
>>> Project.
>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server 
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message