Product:
Search Type:

I use webalizer in domain, how cannot I rebuild processed apache log files anew to calculate missing statistics?

Article ID: 5508 
Last Review: Jul,31 2008
APPLIES TO:
  • Plesk 8.x for Linux/Unix

SYMPTOMS

Domain does have apache logs, however statistics for that period is not shown at http://DOMAIN/plesk-stat/webstat/ when access it through Domains -> DOMAIN -> Report -> Web Stats.

I even tried running Plesk utility statistics manually, however missing statistics was not included though.

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

CAUSE

Plesk utility statistics is 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 or /etc/cron.daily/50plesk-daily.

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


According to cron job statistics runs every day, it processes apache log file /var/www/vhosts/DOMAINS/statistics/logs/access_log and moves it to /var/www/vhosts/DOMAINS/statistics/logs/access_log.processed.N.gz then, next time statistics does not touch it.

If access_log was moved to  access_log.processed.N.gz. normal execution of statistics does not processes the log file anymore and records specified in it is not included.

RESOLUTION

Using instructions below you may force processing of files access_log.processed.N.gz to include statistics from there into domain''s Web Stats.

1. Change to the statistics directory of virtual host DOMAIN:
~# cd /var/www/vhosts/DOMAIN/statistics
statistics]#

2. Backup old webstat directory just in case:
statistics]# cp -rp webstat webstat.back

Note that that directory is shown on domain statistics oage. http://DOMAIN/plesk-stat, you may delete it after statistics reconfiguration.

3. Delete file webalizer.current and modify webalizer.hist, remove records for months you want to recalculate statistics for. For example to remove records for September:
statistics]# rm -f webstat/webalizer.current
statistics]# sed -i '/^9.*/D' webstat/webalizer.hist

4. Unpack the log archives:
statistics]# gunzip ./webstat/access_log.processed.N.gz
...
statistics]# gunzip ./webstat/access_log.processed.1.gz

and 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 -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 -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 -o ./webstat -D /usr/local/psa/var/lib/webalizer/webalizer.cache -N 50 logs/access_log.processed

Note that order of apache logs is important, you should start processing them from the oldest log.

5. Run statistics to process access_log and regenerate indexes:
statistics]# /usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=DOMAIN

Additional information

Where /usr/local/psa is producs root directory and /var/www/vhosts is virtual hosts directory, refer to article http://kb.parallels.com/en/952 to locate the values specified in your system. 
Keywords: missing statistics; webalizer; access_log.processed

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.
*Please type the code you can see.
* - required fields