Regenerating the Cobalt RAQ550 stats

Had to rebuild the webstats for a client on a RAQ550 as for some reason the stats had been corrupted.

The URL to view the stats was: http://www.site.com/stats/

Checking the crontabs showed that there was a script that ran nightly: /etc/cron.daily/webalizer.pl

The script ran through all the sites and built the stats pages for them along with various other things.  The bit we were interested in was:

/usr/local/bin/webalizer -D /home/log/dns.cache -p -n $asite -s $asite -r $asite -q -Q -T -o $thepath $prefix/$asite/logs/web.log

Made a backup of the stats and logs directories with:

mkdir /root/sitestats_backup
tar -cf /root/sitestats_backup /home/sites/www.site.com/logs
tar -cf /root/sitestats_backup /home/sites/www.site.com/web/stats

There were .gz files in the log directory and an empty web.log.  Obviously the web.log file is not populated until the stats program runs later in the day.  Created a combined web.log file in the sites logs directory with:

zcat web.log.3.gz web.log.2.gz web.log.1.gz > web.log.combined

Then, running webalizer:

cd /home/sites/www.site.com/web/stats

/usr/local/bin/webalizer -D /home/log/dns.cache -p -n www.site.com -s www.site.com -r www.site.com -q -Q -T -o /home/sites/www.site.com/web/stats /home/sites/www.site.com/logs/web.log.combined

However, webalizer skipped a lot of entries… so, deleted all the entries in the stats directory (rm *) and then re-ran the command above.  This generated all the stats again without issue.