We have a site specific logfile and one main file for all sites on the server. The main one has a special log format, that allows to see the www adress of the server in the webalizer log:
apache2.conf:LogFormat "%h %l %u %t \"GET %V\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%r\" %P" extended
So here it goes:
ErrorLog "/var/log/apache2/sitename.error.log" CustomLog "/var/log/apache2/sitename.access.log" combined CustomLog "/var/log/apache2/main.access.log" extended
This you have to set in the webalizer.conf:
Incremental yes
Here is how the cronscript looks like:
pre:/etc/apache2# cat /etc/cron.daily/webalizer
#!/bin/sh
# /etc/cron.daily/webalizer: webalizer daily maintenance script
# Written by Remco van de Meent <remco@debian.org>
# Modified by z1 <z1@x21.ch>
WEBALIZER_BIN=/usr/bin/webalizer
WEBALIZER_CONF=/etc/webalizer.conf
# See if the webalizer binary and config file exists
# if not, exit without warning to prevent daily mails
[ -f ${WEBALIZER_BIN} ] || exit 0
[ -f ${WEBALIZER_CONF} ] || exit 0
# Run webalizer quietly
for file in `ls /var/log/apache2/*access*.1`
do
echo $file
hostname1=`echo $file|awk '{split($0, a, "/"); sub("\.access\.log\.1","",a[5]); print a[5]}'`
mkdir /home/weba/public_html/$hostname1
${WEBALIZER_BIN} -c ${WEBALIZER_CONF} -D dns_cache.db -N 10 -o /home/weba/public_html/$hostname1 -n $hostname1 -q $file
${WEBALIZER_BIN} -c ${WEBALIZER_CONF} -D dns_cache.db -N 10 -o /home/weba/public_html/$hostname1 -n $hostname1 -q /var/log/apache2/$hostname1.access.log
done
exit $?
So how to rerun older logs:
for i in `ls -rv /var/log/apache2/sitename.a*.gz`; do /usr/bin/webalizer -c /etc/webalizer/webalizer.conf -D dns_cache.db -N 10 -o /home/weba/public_html/sitename -n sitename -q $i; done