These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for REBUILD Awstats from old logs on the new forum.
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 awstats.pl needs to run inside a wrapper.. I can see /usr/libexec/webmin/virtualmin-awstats/run-all-awstats.pl 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?
Thanx, Falko
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
OPT_SITE=""
fi
# make sure we're running as root
if [ "$UID" != "0" ]; then
echo "Sorry, must be root. Exiting..."
return 1
fi
for f in `ls -1 /etc/awstats`; do
if [ ! -L "/etc/awstats/$f" -a "$f" != "awstats.conf" -a "$f" != "awstats.conf.local" ];
then
part1=`echo $f | cut -d. -f2`
part2=`echo $f | cut -d. -f3`
site=$part1.$part2
echo "**************************************************************"
echo "updating AWstats for website $site"
/usr/lib/cgi-bin/awstats.pl -config=$site -update
fi;
done
Save and rename this script to "awstats.sh" under your home directory ; and run it like this:
# source awstats.sh example.com
=> and it will update the awstats for the 'example.com' website only.
If you want to process all sites, then just run it without parameters
MD