How to recalculate webalizer statistics using processed apache log files

Refers to:

  • Plesk 12.5 for Linux
  • Plesk 10.4 for Linux
  • Plesk 11.0 for Windows
  • Plesk 11.0 for Linux
  • Plesk 11.5 for Linux
  • Plesk 12.0 for Windows
  • Plesk 12.0 for Linux
  • Plesk 9.x and below for Linux

Created:

2016-11-16 12:56:45 UTC

Modified:

2017-02-15 09:21:36 UTC

2

Was this article helpful?


Have more questions?

Submit a request

How to recalculate webalizer statistics using processed apache log files

Symptoms

The domain has Apache logs, however, statistics for that period are not shown at http://domain.tld/plesk-stat/webstat/.

Even if you try running the Plesk utility statistics manually, the missing statistics are not included.

# /usr/local/psa/admin/sbin/statistics

Cause

The Plesk utility statistics is either launched from root crontab ( crontab -l ):

7     4     *     *     *    /usr/local/psa/admin/sbin/statistics >/dev/null 2>&1

... or it is a daily task specified in /usr/local/etc/psa/plesk-cron.daily/50plesk-daily :

# install_statistics
/usr/local/psa/admin/sbin/statistics >/dev/null 2>&1

Since the Plesk 9 , daily task is in /etc/cron.daily/50plesk-daily :

# install_statistics
/usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php >/dev/null 2>&1

According to cron job, statistics runs every day, processing the Apache log file /var/www/vhosts/domain.tld/statistics/logs/access_log and moving it to /var/www/vhosts/domain.tld/statistics/logs/access_log.processed.N.gz . After that, statistics processes access_log.processed.N.gz files.

Resolution

Using the instructions below may force the processing of access_log.processed.N.gz files to include statistics from this location in the domain's Web Stats .

  1. Go to the statistics directory of the virtual host domain.tld:

    For Plesk 11.0 and earlier:

    # cd /var/www/vhosts/domain.tld/statistics

    Since Plesk 11.5 version statistics folder is in /var/www/vhosts/system/domain.tld/statistics , so

    # cd /var/www/vhosts/system/domain.tld/statistics
  2. Back up the old webstat directory (just in case):

    statistics]# cp -rp webstat webstat.back

    Note that this directory is shown on the domain statistics page http://domain.tld/plesk-stat . You may delete it after reconfiguring the statistics.

  3. Delete the file webalizer.current and modify webalizer.hist , removing records for the months you want to recalculate statistics for. For example, to remove records for September (the 9th month), execute the following:

    statistics]# rm -f webstat/webalizer.current
    statistics]# sed -i '/^9.\\*/D' webstat/webalizer.hist
  4. Unpack the log archives:

    statistics]# gunzip logs/access_log.processed.N.gz
    ...
    statistics]# gunzip logs/access_log.processed.1.gz

Run webalizer to process logs access_log.processed.N , access_log.processed.1 , and access_log.processed :

    statistics]# /usr/bin/webalizer -F clf -p -c ../conf/webalizer.conf -n domain.tld -o ./webstat -D /usr/local/psa/var/lib/webalizer/webalizer.cache -N 50 logs/access_log.processed.N
...

statistics]# /usr/bin/webalizer -F clf -p -c ../conf/webalizer.conf -n domain.tld -o ./webstat -D /usr/local/psa/var/lib/webalizer/webalizer.cache -N 50 logs/access_log.processed.1

statistics]# /usr/bin/webalizer -F clf -p -c ../conf/webalizer.conf -n domain.tld -o ./webstat -D /usr/local/psa/var/lib/webalizer/webalizer.cache -N 50 logs/access_log.processed

Remember to replace domain.tld with the domain name you want to recalculate statistics for.

Also since Plesk 11.5 version webalizer.cache is located in /usr/local/psa/var/webalizer/webalizer.cache .

Note that the order of Apache logs is important: you should start processing them from the oldest log. For example, access_log.processed.20 then access_log.processed.19 and so on.

  1. Run statistics to process access_log and regenerate indexes:
    statistics]# /usr/local/psa/admin/sbin/statistics --generate-domain-webstat --domain-name=domain.tld

Additional Information

If /usr/local/psa is the product root directory and /var/www/vhosts is the virtual hosts directory, refer to #213412249 Knowledge Base article to locate the values specified in your system.

Have more questions? Submit a request
Please sign in to leave a comment.