use vlogger with apache2

vlogger [1] is a nice piece of software to deal with large number of virtual hosts. It is meant to work with apache by piping the logs to the vlogger process that will then take care of storing them in you log directory.

I found an excellent howto that describes how to install vlogger in debian [2] .

To better integrate it with webalizer you can use this small bash snippet to generate conf files automatically for all your vhosts. This assumes that your log files are stored in /var/log/apache2 and that you don’t have any other directories there but those generated by vlogger.

#!/bin/sh

for vhost in `ls -l /var/log/apache2 | grep "^d" | awk '{print $9}'`; do

cat <<EOF >> $vhost.conf
LogFile /var/log/apache2/$vhost/access.log
LogType clf
OutputDir /var/www/webalizer/$vhost
Incremental yes
IncrementalName webalizer.current
ReportTitle Usage statistics for
HostName $vhost
PageType    htm*
PageType    cgi
PageType    php3
PageType    php
DNSCache    dns_cache.db
HideURL     *.gif
HideURL     *.GIF
HideURL     *.jpg
HideURL     *.JPG
HideURL     *.png
HideURL     *.PNG
HideURL     *.ra
IgnoreSite  localhost
IgnoreReferrer  localhost
SearchEngine    yahoo.com   p=
SearchEngine    altavista.com   q=
SearchEngine    google.com  q=
SearchEngine    eureka.com  q=
SearchEngine    lycos.com   query=
SearchEngine    hotbot.com  MT=
SearchEngine    msn.com     MT=
SearchEngine    infoseek.com    qt=
SearchEngine    webcrawler  searchText=
SearchEngine    excite      search=
SearchEngine    netscape.com    search=
SearchEngine    mamma.com   query=
SearchEngine    alltheweb.com   query=
SearchEngine    northernlight.com  qr=
SearchEngine    sensis.com.au   find=
SearchEngine    google.nl   q=
SearchEngine    google.fr   q=
SearchEngine    google.ch   q=
SearchEngine    google.ca   q=
SearchEngine    google.be   q=
EOF

done

[1] http://n0rp.chemlab.org/vlogger/ [2] http://www.howtoforge.com/apache_log_splitting_vlogger