Update Stats in Plesk

November 27, 2006 / Plesk

To update webstats on Plesk use this command./usr/bin/webalizer-n domain name -o /home/httpd/vhosts/domain name/webstat/ /home/httpd/vhosts/domain name/logs/access_logalso note that in webalizer.conf which is in /etc/webalizer.conf this entry should be commented dns_cache.dbThe above command will update stats for only one domain but if you want to update stats for the whole server then use



To update web stats for specific domains use the following command.
Replace DOMAINNAME.COM with clients domain name.

/usr/local/plesk/webstats DOMAINNAME.COM

To update stats for all the domains on that server use

If you face any problem or get an error like the below:
Error: Unable to restore run data (99)

Then take the following steps to resolve this problem:

  • cd /usr/local/plesk/apache/htdocs/stats/domain.com
  • remove files Webalizer. current and Webalizer.hist
  • /usr/local/plesk/webstats DOMAINNAME.COM

But keep in mind that doing this is going to lose ALL previous stats too… but that is because the stats program became corrupted on this domain. this will fix it

then update stats as i showed you before and you should not get any error

even if this does not work, I mean to say, if the website stops itself, then check the following

Check the root user’s crontab (crontab -l when logged in as root) and see if statistics is enabled, or even present. The line SHOULD be:

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

That may not be the only way this was disabled, but it’s a likely way.

Check that one or more of your log files is larger than 2 Gig, in which case the statistics program will not run (which is probably why it was disabled in the first place).

Also, check your Webalizer. conf setting to make sure that it is not set to ‘quiet’ mode, this will allow you to see any error messages that Webalizer may have BTW, the ’statistics’ program does a lot more than just trigger Webalizer.

Amongst other things, it also takes care of the web log file rotations and PSA usage calculations. It would suggest to anyone wanting to disable web stats that they do NOT disable the ’statistics’ program, but rather that they simply rename the Webalizer program (and perhaps drop an empty ‘true’ script in its place to avoid any errors).

Other than the 2 Gig file limit that causes the ’statistics’ program to crash, I don’t know what it could be.

BTW, the reason ’statistics’ crashes is that it attempts to append the ‘access_log’ to the ‘access_log.processed’ file. So, if your situation is such that the sum of these two files for any one domain exceeds 2 Gig (which could be the case given the numbers you indicated), then it could still be the root of the problem.

If that is the case, then manually rotate the ‘access_log.processed’ file(s) so that statistics will create a new one from the ‘access_log’ file. Since the hit data in the ‘processed’ log file(s) has already been processed by the ’statistics’ program, you could in theory simply delete them.

However, I like to keep these files just in case I need to go back and look for any problems. If you do not currently have log rotation turned on, you can use the following command to manually rotate the processed file(s):

mv access_log.processed access_log.processed.1
gzip -9 access_log.processed.1

If you have log rotation turned on, you will need to rename your existing logs first (increment each file by one).

I also want to mention that the 2 Gig file problem is with the ’statistics’ program and not Webalizer. The statistics program sends the hit data to Webalizer via the ‘/dev/stdin’ so Webalizer never actually accesses any log file directly. So, basically, I don’t think Webalizer has anything to do with the actual problem but is merely a symptom.

If you still want to disable Webalizer (just to prove that it has nothing to do with your current problem), you could do the following:

Change to the directory with Webalizer:

cd /usr/bin

Rename the original Webalizer program:

mv Webalizer Webalizer.bak

Then create a dummy file in its place:

touch Webalizer

And finally, change the privileges so that it is an ‘executable’ file:

chmod 755 Webalizer

Now, just to confirm, you should be able to run the new Webalizer program, and it will put you instantly back at the prompt.


This is what will happen when statistics call it. Now run trigger the statistics program and see what you get:


So, this concludes the chapter on how to disable Webalizer on a server without disabling the ’statistics’ program.

Additionally, you may want to try running Webalizer on a site manually to see what it comes up with. Although the ’statistics’ program calls Webalizer 6 times for each domain (once to populate the DNS cache and once to create the actual statistics for each of the services – HTTP, HTTPS, and FTP), the example below is all you need to do to run it for the HTTP log.

You could also run it for the HTTPS and FTP logs if you have these options enabled for the site. Since you will be triggering Webalizer based on a log file (as opposed to passing the data via /dev/stdin like ’statistics does), you do NOT have to do a separate call to populate the DNS cache.

/usr/bin/webalizer -n [d] -D /usr/local/psa/var/webalizer.cache -p -N 15 -o [r] -F clf [log]

– the command above is a single line
– replace [d] with your domain name (ex: mydomain.com)
– replace [r] with the webstat dir for that domain (ex: /home/httpd/vhosts/mydomain/webstat)
– replace [log] with the log file you want to process (ex:/home/httpd/vhosts/mydomain/logs/access_log.processed)

One important thing to keep in mind is that Webalizer uses the ‘current’ and ‘hist’ files to do incremental processing. In order for this to work, it will skip any hit data prior to the last data it has already processed (to avoid double-processing). This means that you MUST process your hit data in chronological order or you will have missing chunks of data.

Also, this means that you can re-process already processed log files without worrying about screwing up your stats. So, I would start with the ‘access_log.processed’ file first, and then the ‘access_log’ file just to be safe. Then you should have current statistics for that domain.

ERROR: I rotated all but logs but now when running statistics manually I get several errors :

Webalizer V2.01-10 (Linux 2.4.20-18.7) English
Using logfile STDIN (clf)
DNS Lookup (15): Error: Unable to open DNS cache file /usr/local/psa/var/webalizer.cache

DNS Lookup (15): Error: Unable to open DNS cache file /usr/local/psa/var/webalizer.cache
Webalizer V2.01-10 (Linux 2.4.20-18.7) English
Using logfile STDIN (clf)

Try this:

stat /usr/local/psa/var/webalizer.cache

And post the results. Hopefully, there will be something in there that will stand out.


The stats are freezing due to the oversize file of access_log for domains.

Please either trim them or empty those access logs so that web stats can update for all the domains smoothly. If it seems that these sites are the most visited sites on the server, then enable the log rotation for those domains. Please check the log rotation settings and make changes as required(size-wise or time-wise).

To manually update the logs on the server please use the following command.