Search Type:
Search for:

Language:

Product:
Category:
No categories for selected product

How to recalculate AWstats statistics from logs from previous months?

Article ID: 5550 
Last Review: Jun,23 2009
Author: Bezborodova Anastasiya
Last updated by: Bezborodova Anastasiya APPLIES TO:
  • Plesk 8.x for Linux/Unix

Resolution

Plesk's 'statistics' utility does not use info from previous months' log records and builds AWstats pages for the current month only. To build AWstats pages for previous months follow these steps:

    0) define these environment variables according to requirements: set needed domain name

export vhost_name=SET.REAL.DOMAIN.NAME.HERE


and set the following ones pretty much the same:

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"


    1) check if there are *.txt files in statistics/webstat directory for previous months. If there are and you wish to build statistic pages using the information stored in these data files then skip to step #4

    2) remove all *.txt files from the statistics/webstat directory:

find $HTTPD_VHOSTS_D/$vhost_name/statistics/webstat -name '*.txt' -exec rm -f '{}' \;


    3) find the necessary log file and analyze it with awstats:

$awstats $awstats_gen_opts -LogFile=$HTTPD_VHOSTS_D/${vhost_name}/statistics/logs/access_log.processed


    4) create missing time stamped (in format 'YYYY-MM') directories for the period of processed log file in statistics/webstat subdirectory of virtual host:

for y in 2007 2008 ; do for m in `seq 1 12` ; do mkdir ${HTTPD_VHOSTS_D}/${vhost_name}/statistics/webstat/$y-$(printf "%.2d" $m) ; done ; done


    5) run this cycle to build statistics pages:

for y in 2007 2008 ; do \
 for m in `seq -w 1 12` ; do \
     dest_dir=$HTTPD_VHOSTS_D/$vhost_name/statistics/webstat/$y-$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


    6) run 'statistics' command to update the upper frame navigation menu with month listing:

$PRODUCT_ROOT_D/admin/sbin/statistics --calculate-one --domain-name=$vhost_name




Subscription for changes to this article Subscription for changes to this article

Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
* - required fields
 
 
 
 
 
 
For Home
For Business
For Hosters
For SaaS
For Developers
 
Desktop Virtualization
- Parallels Desktop Switch to Mac Edition
- Parallels Desktop for Mac
- Parallels Desktop 4 for Windows & Linux
- Parallels Workstation Extreme
- Parallels Solution for Windows 7
Server Virtualization
- Parallels Server for Mac
- Parallels Server 4 Bare Metal
- Parallels Virtuozzo Containers
Automation
- Parallels Operations Automation
- Parallels Business Automation
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
More Products