ISPConfig3 - How to reprocess all awstats logs

I recently moved some sites from ispconfig2 to ispconfig3 and only realised after a week that I had forgotten to first copy over the awstats data files and now have some web logs archived and new stats pages created.

So an idea came to mind to script something together to reprocess all logs for all sites or just a single site using a -d {www.website.tld} parameter and it worked like a charm.

 

First thing that needed to be done is clear all the awstats*.www.website.tld.txt files from the current/new site so we can copy over from the old server to thenew server.

On current/new ispconfig3 server :

1. rm /var/lib/awstats/awstats*.www.website.tld.txt # change the path to your awstats data dir.

Now copy old awstats files to ispconfig3 server.

2. scp ispc2server:/var/lib/awstats/awstats*.www.website.tld.txt /var/lib/awstats/

Now we have the old data and now just need to reprocess the new server logs. Using my script, here are the 2 methods.

3a. php awstats_log_reprocess.php # Reprocess all websites, this shouldn't damange current logs as it'll ignore already processed entries.

3b. php awstats_log_reprocess.php -d www.website.tld # This will process a single site only, good for a test run.

 

This script worked well for me, only catch which I'd like to warn you now is that since processing is done on a daily basis via cron, you may want to run a /usr/bin/perl /var/lib/awstats/awstats_updateall.pl -awstatsprog=/usr/lib/cgi-bin/awstats.pl now as some entries in your logs may not be processed when you moved to the new ispconfig3 server. This caught me out but only lost half a days info.

Download 1.0

If you feel this was helpful to you and would like to donate $5 or any figure you feel, please help my research/work by donating below.