Our Community

DomainGurus Forums » Plesk Parallels Control Panel

  1. JC
    Member

    How to recalculate statistics for my domain in Plesk?

    Posted 10 months ago #
  2. sysadmin
    Moderator

    'To update the statistics of your domain you must run the following lines in your command line of windows:

    %plesk_install%statistics.exe --ftp-web-statistics --process-domains=domain.com --from-date="2009/01/01"
    %plesk_install%statistics.exe --http-web-statistics --process-domains=domain.com --from-date="2009/01/01"

    where date field must use the format year/month/day, from this date, statistics.exe is going to generate the statistics for the domain in question, make sure the logs exist from the dates that seeks to generate.'

    Posted 10 months ago #
  3. Chris
    Moderator

    On a Linux OS we can do the following:

    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 inseq 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 <code>seq -w 1 12</code> ; 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

    You can try and make your own script for this instructions but, remember, you are responsible for your own script.
    Enjoy!

    Posted 10 months ago #

Reply

You must log in to post.