By default, Plesk utilities present only the current month’s statistics
in HTML format. You can retrieve HTML statistics for previous months
using the AWstats utility. To do this, restore traffic usage information
from logs and run the utility manually. Detailed instructions are
provided below.
To recalculate statistics for previous months:
-
Define the required environment variables by running the commands:
export vhost_name=<domain_name> 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"
-
Remove
*.txt
files from the
$HTTPD_VHOSTS_D/system/<domain_name>/statistics/webstat
directory
by running the command:find $HTTPD_VHOSTS_D/system/$vhost_name/statistics/webstat -name '*.txt' -exec mv '{}' '{}'.orig ;
-
Analyze the domain log files with
awstats
by running the command:$awstats $awstats_gen_opts -LogFile=$HTTPD_VHOSTS_D/system/${vhost_name}/statistics/logs/access_log.processed
This command creates subdirectories with the names “YYYY-MM” in the
$HTTPD_VHOSTS_D/system/<domain_name>/statistics/webstat
directory. “YYYY” and “MM” show the year and the month in which the
corresponding statistics were collected.If you want to rebuild statistics pages for a long period, you should
start recalculation from the earliest log files. For example, if you
have set the number of log files to 10 analyze files in the following
order: access_log.processed.10, access_log.processed.9, …
access_log.processed.1, access_log.processed. -
If any of directories with names in ‘YYYY-MM’ format for the
recalculation period are missing, create them by running the…