• Article for your preferred language does not exist. Below is international version of the article.

Article ID: 115476, created on Jan 30, 2013, last review on Nov 10, 2016

  • Applies to:
  • Plesk for Linux/Unix


How to recalculate AWStats web statistics from domain logs for previous months?


Run the following commands in order to download, unpack and execute the script on the server:

# wget https://kb.plesk.com/Attachments/kcs-10115/rebuild_awstats.tar.gz
# tar -xzvf rebuild_awstats.tar.gz
# ./rebuild_awstats.sh

If no arguments are given, the script will display "help message".

Note: for Ubuntu 14.04 as additional step the following symbolic link should be created:

# ln -s /usr/lib/plesk-9.0/logresolvemerge /usr/share/doc/awstats/examples/logresolvemerge.pl

See more information how the script works below.


For each specified domain (or all domains, if the -A option is used), the script will memorize the log file's start date. Then, it will remove AWStats data files for the months covered by the log files and rebuild them with corresponding information. Finally, the script builds static pages with a statistics summary for each month covered by the log files.

Alternatively, if the -F option is used, all data files will be removed and new files will be generated using the information from the log files.


# ./rebuild_awstats.sh

Usage: ./rebuild_awstats.sh [options] [<domains...>]

        Process all domains. If this option is not specified, then list of
        domains to process must be provided.

        Remove contents of webstat/ and webstat-ssl/ directories before
        rebuilding statistics pages (originals are saved with numeric
        suffix). Statistics will be rebuilt from logs only, only for
        period covered by log files. If this parameter is not used, then
        statistics is recalculated beginning on the month on which log files
        start (if log starts in the middle of the month, then statistics
        for first half of the month will not be present.)

        This message.

Output example

For each processed domain, the script will report message like:

=== pp11.plesk.ru
Saving: webstat* --> webstat*.9
Logs begin on Oct 27 2012
access_log* (new/old/corrupted): 9/0/0
access_ssl_log* (new/old/corrupted): 71/0/0
Rebuilding static pages: 2012-10 2012-11 2012-12 2013-01 2013-02

As you can see, the original directories are saved with a numeric suffix (the suffix is increased if the destination directory already exists). As a result, it is possible to roll-back to a previous version if it will be required.

Additional information

Use this article #117731 if the script fails with the following error:

./rebuild_awstats.sh: line 210: /usr/share/awstats/tools/logresolvemerge.pl: No such file or directory
ERROR: failed to merge access_log*. Skipping domain.
ERROR /usr/share/awstats/wwwroot/cgi-bin/awstats.pl cannot be executed.

Search Words

awstats show more page views than actual clients

awstats aktualisiert nicht mehr

awstats browser detection not working plesk

domain statistics awstats not similar

recalculate AWstats

prmpt password

awstats and domain stats are not in sync

awstats not work


Web statistics won't work

Webalizer not working [IKG]

sqlstate can't create/write file

Statistics not found

awstats and domain stats are not in sync'

awstats doesnt generate html files

404 Not Found AWStats Plesk 12

statistics aren't online

incorrect stats for the last day of the month

static plesk

Webstat is not working

not found quand on consulte les statistiques

Web stats not displaying



AWstats didn´t work for a domain

statistics not showing

The system cannot find the file specified. (Error code 2) at CreateProcess

plesk statistics don't work

awstat not calculating statistics for last months

/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=b

recalculate webstatistics

AWStats are not displaying

Not Found The requested document was not found on this server.

Error: Unable to restore run data



HTML pages of awstats statistics are not generated

The requested document was not found on this server. Awstats PLesk

problema http traffic statistic

Web-statistics in Plesk

statisitic not automatic

Webstatistic don´t show any Visitors in a month

Statistics update awstats

Unable to parse pending domains traffic line

statistics wrong calculated with plesk 11.5

statistics Search Keyphrases

incorrect stats

AWStats not showing statistics

accessing websites or ftp stats is blank

AWStats not updating

awstats not working


56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838

Email subscription for changes to this article
Save as PDF