REBUILD Awstats from old logs

I recently moved the servers to a new host and for 3-4 months awstats hadn’t been working because I failed to install Geoip, so therefore every domain has between Jan and today no visitor data in awstats.

So lets import these logs, but how?

I can see that needs to run inside a wrapper… I can see /usr/libexec/webmin/virtualmin-awstats/ that updates all domains…

But I’m having no luck modifying that script to temporarily read /home/$domain/logs/access_log (or ideally be able to extract the access_log.x.gz files – that would be great!)

Is there an existing script somewhere here to rebuild awstats ?? Would appreciate any help as this is urgent.

Regards Steven

Hi Steven,

did you have any success on using awstats for you old log files, in the meantime?


Same problem with me. Here’s the script I created. It works very well for processing all the ‘awstats’.

#!/bin/bash source ./.bashrc OPT_SITE=$1

if [ “$OPT_SITE” == “-” ]; then

make sure we’re running as root

if [ “$UID” != “0” ]; then
echo “Sorry, must be root. Exiting…”
return 1

for f in ls -1 /etc/awstats; do
if [ ! -L “/etc/awstats/$f” -a “$f” != “awstats.conf” -a “$f” != “awstats.conf.local” ];
part1=echo $f | cut -d. -f2
part2=echo $f | cut -d. -f3
echo “**************************************************************”
echo “updating AWstats for website $site”
/usr/lib/cgi-bin/ -config=$site -update

Save and rename this script to “” under your home directory ; and run it like this:


=> and it will update the awstats for the ‘’ website only.

If you want to process all sites, then just run it without parameters