Resolution
Plesk statistics utility does not use info from the log records of the previous months and only builds AWstats pages for the current month. In order to rebuild AWstats pages for previous periods, follow these steps:0. Define these environment variables according to requirements:
Set the needed domain name
export vhost_name=<DOMAIN NAME>
Set other variables:
export AWSTATS_BIN_D=`grep ^AWSTATS_BIN_D /etc/psa/psa.conf | awk '{print $2}'`
export HTTPD_VHOSTS_D=`grep ^HTTPD_VHOSTS_D /etc/psa/psa.conf | awk '{print $2}'`
export PRODUCT_ROOT_D=`grep ^PRODUCT_ROOT_D /etc/psa/psa.conf | awk '{print $2}'`
export awstats=${AWSTATS_BIN_D}/awstats.pl
export awstats_gen_opts="-staticlinks -configdir=${PRODUCT_ROOT_D}/etc/awstats -config=${vhost_name}-http"
export awstats_gen_opts_ssl="-staticlinks -configdir=${PRODUCT_ROOT_D}/etc/awstats -config=${vhost_name}-https"
1. Check if directories $vhost_name/statistics/webstat and $vhost_name/statistics/webstat-ssl contain *.txt files with the information from previous periods. Skip to step #4 if you wish to use these data during the AWstats page rebuild.
2. Rename *.txt files from the directories:
find $HTTPD_VHOSTS_D/$vhost_name/statistics/webstat -name '*.txt' -exec mv '{}' '{}'.orig \;
find $HTTPD_VHOSTS_D/$vhost_name/statistics/webstat-ssl -name '*.txt' -exec mv '{}' '{}'.orig \;
3. Analyze access to the log file with the information from previous periods by awstats:
$awstats $awstats_gen_opts -LogFile=$HTTPD_VHOSTS_D/${vhost_name}/statistics/logs/access_log.processed
$awstats $awstats_gen_opts_ssl -LogFile=$HTTPD_VHOSTS_D/${vhost_name}/statistics/logs/access_ssl_log.processed
If multiple log files are to be re-processed, start from the oldest one.
4. Create appropriate (in format 'YYYY-MM') directories hierarchy for the period covered by the log files to be processed in the $vhost_name/statistics/webstat directory:
for y in 2007 2008 ; do for m in 1 2 3 4 5 6 7 8 9 10 11 12 ; do mkdir ${HTTPD_VHOSTS_D}/${vhost_name}/statistics/webstat/$y-$(printf "%.2d" $m) ; done ; done
for y in 2007 2008 ; do for m in 1 2 3 4 5 6 7 8 9 10 11 12 ; do mkdir ${HTTPD_VHOSTS_D}/${vhost_name}/statistics/webstat-ssl/$y-$(printf "%.2d" $m) ; done ; done
NOTE: put required years instead of 2007 2008 and month instead of 1 2 3 4 5 6 7 8 9 10 11 12 in the commands above.
5. Run the following cycle to rebuild AWstats pages.
For HTTP statistics:
for y in 2007 2008 ; do \
for m in 1 2 3 4 5 6 7 8 9 10 11 12 ; do \
dest_dir=$HTTPD_VHOSTS_D/$vhost_name/statistics/webstat/$y-$(printf "%.2d" $m) ; \
$awstats $awstats_gen_opts -month=$m -year=$y -output > $dest_dir/awstats.${vhost_name}-http.html ; \
ln -s $dest_dir/awstats.${vhost_name}-http.html $dest_dir/index.html ; \
for output in alldomains allhosts lasthosts unknownip allrobots lastrobots session urldetail urlentry urlexit osdetail unknownos refererse refererpages keyphrases keywords errors404 ; do \
$awstats $awstats_gen_opts -month=$m -year=$y -output=$output > $dest_dir/awstats.${vhost_name}-http.$output.html ; \
done ; \
done ; \
done
For HTTPS statistics:
for y in 2007 2008 ; do \
NOTE: put required years instead of 2007 2008 and month instead of 1 2 3 4 5 6 7 8 9 10 11 12 in the commands above.
6. Run the statistics command to update the upper frame navigation menu with the month listing:
$PRODUCT_ROOT_D/admin/sbin/statistics --calculate-one --domain-name=$vhost_name
Additional information
HTTP statistics is available at https://DOMAIN NAME>/plesk-stat/webstat.HTTPS statistics is available at https://DOMAIN NAME>/plesk-stat/webstat-ssl