Apache + 20 virtual hosts + awstats?
September 17, 2008 12:41 PM   Subscribe

Apache + 20+ virtual hosts + awstats with one access log?

Can one configure awstats to properly render individual awstats pages per virtual host if all virtual hosts are writing to the same access log?
posted by xmutex to Technology (15 answers total)
 
Yup. You need an separate config files for each domain, named, and set the SiteDomain= and HostAliases= and DirData= config entries as suited. Then run awstats.pl -update -config=filename for each host. I do that automatically in apache logrotate, just before the log is rotated out.
posted by benzo8 at 1:00 PM on September 17, 2008


benzo: Is there anything you'd need to do the LogFormat of the access log so that it includes virtual host information?
posted by xmutex at 1:15 PM on September 17, 2008


I believe the logging token is %V.
posted by rhizome at 1:22 PM on September 17, 2008


I use:

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost
CustomLog /var/log/apache/access.log vhost

On preview: Yes, it's the %v that's important.
posted by benzo8 at 1:24 PM on September 17, 2008


I'm assuming it's better for Apache to dump all access information into one log vs. N number of virtual host specific access logs. Anyone have thoughts?
posted by xmutex at 1:25 PM on September 17, 2008


I run a LogFormat like benzo8's and then pipe the output into vlogger which automatically sorts the log lines into separate files without my having to separately configure the virtual hosts, and rotates them by date in the bargain. Here's my configuration:

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vlogger
CustomLog "| /usr/local/bin/vlogger -u httpd -g httpd -s access_log -t access_log.%Y%m%d /web/logs" vlogger

posted by nicwolff at 1:51 PM on September 17, 2008


Thanks. One last question- I assume the LogFormat line in the awstats conf files must match the Apache line verbatim?
posted by xmutex at 2:44 PM on September 17, 2008


Here's the LogFormat directive I use in the awstats configuration files:

LogFormat="%virtualname %host %logname %other %time1 %methodurl %code %bytesd %refererquot %uaquot"

Basically - yup - awstats needs to know what each field in the access.log represents.
posted by benzo8 at 2:55 PM on September 17, 2008


Do you guys separate SSL access logs?
posted by xmutex at 2:57 PM on September 17, 2008


Indeed - it's basically a different server, so it gets different logs and different configuration.
posted by benzo8 at 3:02 PM on September 17, 2008


Thanks bezno8- appreciate it.
posted by xmutex at 3:13 PM on September 17, 2008


I'm assuming it's better for Apache to dump all access information into one log vs. N number of virtual host specific access logs. Anyone have thoughts?

I've never encountered Apache being bound by its logging. Lots of other things, but not logging. I would be extremely surprised if having a log per vhost would have any noticeable impact on performance.
posted by rodgerd at 4:17 PM on September 17, 2008


Most setups I have seen have one log per vhost. Certainly tidier.
posted by rokusan at 4:25 PM on September 17, 2008


Google Analytics?
posted by SirStan at 9:43 PM on September 17, 2008


If the question is about awstats, Google Analytics are not the answer, especially since they'll miss everybody with the NoScript extension.
posted by rodgerd at 12:13 AM on September 18, 2008


« Older Boarded Up   |   How do I trigger a specific template rebuild in MT... Newer »
This thread is closed to new comments.