You are on page 1of 12

AWSTATS

http://kb.parallels.com/en/114797
How to enable daily maintenance (statistics) script logging
APPLIES TO:
Parallels
Parallels
Parallels
Parallels

Plesk
Plesk
Plesk
Plesk

Panel
Panel
Panel
Panel

11.x
10.x
11.x
10.x

for
for
for
for

Linux
Linux
Windows
Windows

Linux
Replace the content of /etc/cron.daily/50plesk-daily with the below
content. Do not forget to back up the original file.
#!/bin/sh
exec 1>>/root/50plesk-daily.log
exec 2>&1
set -x
export PLESK_DEBUG_LEVEL=4
# install_statistics
/usr/local/psa/bin/sw-engine-pleskrun
/usr/local/psa/admin/plib/DailyMaintainance/script.php
# install_mysqldump
/usr/local/psa/bin/mysqldump.sh >/dev/null 2>&1
Debug logs will be collected in /root/50plesk-daily.log. Replace the
/etc/cron.daily/50plesk-daily file with the original one once you are
done monitoring.
Windows
- Terminate all hanging daily maintenance task processes
- Turn off the daily maintenance task in the Task Scheduler to avoid
interference from its side

- Run the following commands on the server:


set PLESK_DEBUG_LEVEL=4
"%plesk_dir%\admin\bin\php.exe" -dauto_prepend_file=""
-ddisplay_errors=on "%plesk_dir
%\admin\plib\DailyMaintainance\script.php" >>
c:\debug_maintenance.log
This will collect debug logs in c:\debug_maintenance.log.
Once you are done monitoring:
- Close the command prompt window where you ran the above
commands
- Enable the daily maintenance task in the Task Scheduler
Rerun daily maintenance tasks separately
APPLIES TO:
Parallels Plesk Panel 11.x for Linux

Information
Since Parallels Plesk Panel 11, the DailyMaintenance task now has
options that allow you to execute separate maintenance tasks. This
provides an easy way to debug Micro-Update detection problems or
key update problems. You do not need to rerun the daily task as a
whole and wait for the statistics task to finish anymore. Here is a
usage example:
# /usr/local/psa/bin/sw-engine-pleskrun
/usr/local/psa/admin/plib/DailyMaintainance/script.php -h
o Usage: script.php [period|option]
o Period can be one of the following:
o
daily weekly monthly
o Option can be one of the following:
o
-h
usage screen
o
-l
list available tasks
o
-f <name>
execute only one task with name <name>

Let us imagine that we only want to rerun the key update task:
# /usr/local/psa/bin/sw-engine-pleskrun
/usr/local/psa/admin/plib/DailyMaintainance/script.php -l
o CheckForUpdates
o InstallUpdates
o update-keys
o plesk-usage
o autoreport
o sitebuilder
o mail-usage
o execute-statistics
o optimize-statistics
o analyse-domain-statistics
o analyse-client-statistics
o execute-spamtrain
o execute-glcleaner
o execute-apache-config-rotation
o ppsmbe-filesharing
o UpgradePanel
# export PLESK_DEBUG=1
# /usr/local/psa/bin/sw-engine-pleskrun
/usr/local/psa/admin/plib/DailyMaintainance/script.php -f updatekeys
o [Mon, 20 Aug 2012 11:11:03 +0700] > 0 Starting: Daily
Maintainance
o [Mon, 20 Aug 2012 11:11:03 +0700] > 0 == Begin Update keys
o [Mon, 20 Aug 2012 11:11:03 +0700] > 0 updating scheduled
keys
o [Mon, 20 Aug 2012 11:11:04 +0700] > 0 update resultCode=2
resultDesc=Key update disabled
o [Mon, 20 Aug 2012 11:11:04 +0700] > 0 == End Update keys
o [Mon, 20 Aug 2012 11:11:04 +0700] > 0 Finish: Daily
Maintainance
Daily maintenance script
root@server1 ~ # ps aux | grep Daily | grep pts/3
root
23689 0.0 0.1 206660 23232 pts/3 S+ Aug24 0:00
/usr/bin/sw-engine -c /opt/psa/admin/conf/php.ini

/usr/local/psa/admin/plib/DailyMaintainance/script.php -f executestatistics
Aw-stats configuration directories and then ran the daily
maintenance script to calculate statistics in the server.
root@server1 ~ # grep AWSTATS /etc/psa/psa.conf
AWSTATS_ETC_D /etc/awstats
AWSTATS_BIN_D /usr/lib/cgi-bin
AWSTATS_TOOLS_D /usr/share/awstats/tools
AWSTATS_DOC_D /usr/share/awstats
Calculate the statistics for all the domains:
root@server1 ~ # /usr/local/psa/admin/bin/statistics --calculate-all
Calculate the statistics for a domain
/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=
Verified structure of the webstat directories on the file system
[root@david-host-me-uk ~]# find /var/www/vhosts/cruisecommunity.me.uk/statistics/webstat/ -type d
/var/www/vhosts/cruise-community.me.uk/statistics/webstat/
/var/www/vhosts/cruise-community.me.uk/statistics/webstat/2013-08
/var/www/vhosts/cruise-community.me.uk/statistics/webstat/2013-09
/var/www/vhosts/cruise-community.me.uk/statistics/webstat/2013-07
Recalculate using webstatmng
[root@david-host-me-uk ~]# /usr/local/psa/admin/bin/webstatmng
--calculate-rotated-statistics --stat-prog=awstats --domainname=cruise-community.me.uk
Create/Update database for config
"/usr/local/psa/etc/awstats/awstats.cruise-community.me.ukhttps.conf" by AWStats version 7.1.1 (build 1.989)
Recalculate AWstats statistics from logs for previous months
http://kb.parallels.com/en/5550
# wget
http://kb.parallels.com/Attachments/23491/Attachments/rebuild_aws

tats.zip
# unzip rebuild_awstats.zip
# chmod u+x rebuild_awstats.sh
# ./rebuild_awstats.sh
Algorithm
For each specified domain (or for all domains if the -A option used),
learn the log files' start date. Remove AWstats data files for months
covered by the log file and rebuild them with information from the
logs. Then build static pages with a statistics summary for every
month covered by the log files.
Alternatively, if the -F option is used, then all data files are removed
and new files are generated using information from the log files.
# ./rebuild_awstats.sh
Rebuild AWstats static pages from available log files.
Usage: ./rebuild_awstats.sh [options] [<domains...>]
Options:
-A
--all-domains
Process all domains. If this option is not specified, then list of
domains to process must be provided.
-F
--from-scratch
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.)
-h
--help
This message.

Home page: <http://kb.parallels.com/en/115476>


Example output
For each processed domain, the script reports the following:
=== 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, it saves the original directories with a numeric suffix
(the suffix is increased if the destination directory already exists), so
it is possible to roll-back to a previous version if needed
Database tables associated
mysql> select id from domains where name='cruisecommunity.me.uk';
mysql> desc DomainsTraffic;
mysql> select date, http_in, http_out from DomainsTraffic where
dom_id='9';
https://support.parallels.com/Ticket/Display.html?id=1681802
https://support.parallels.com/Ticket/Display.html?id=1674266
https://support.parallels.com/Ticket/Display.html?id=1688358
https://support.parallels.com/Ticket/Display.html?id=1674315
https://support.parallels.com/Ticket/Display.html?id=1659437
On Windows
C:\Inetpub\vhosts\proishunting.com\statistics\webstat\AWStats\cgibin>
perl awstats.pl -config=los-gayumbos.com
-DirData=C:\Inetpub\vhosts\los-gayumbos.com\statistics\webstat
-LogFile=C:\Inetpub\vhosts\los-

gayumbos.com\statistics\logs\W3SVC15010\extend4.log -year=2013
-month=09 -showcorrupted
perl awstats.pl -config=los-gayumbos.com
-DirData=C:\Inetpub\vhosts\los-gayumbos.com\statistics\webstat
-LogFile=C:\Inetpub\vhosts\losgayumbos.com\statistics\logs\W3SVC15010\extend4.log -year=2013
-month=09 -update
C:\inetpub\vhosts\enic-naric.net\statistics\logs\W3SVC32
C:\>"%plesk_bin%\websrvmng.exe" --get-vhost-log-dir --vhostname=enic-naric.net
C:\Inetpub\vhosts\enic-naric.net\statistics\logs\W3SVC32
C:\>cd %plesk_bin%
C:\>cd %plesk_bin%
============
perl awstats.pl -config=enic-naric.net
-DirData=C:\inetpub\vhosts\enic-naric.net\statistics\webstat
-LogFile=C:\inetpub\vhosts\enicnaric.net\statistics\logs\W3SVC32\u_ex1309.log -year=2013
-month=09 -showcorrupted
perl awstats.pl -config=enic-naric.net
-DirData=C:\Inetpub\vhosts\enic-naric.net\statistics\webstat
-LogFile=C:\inetpub\vhosts\enicnaric.net\statistics\logs\W3SVC32\u_ex1309.log -year=2013
-month=09 -update
C:\inetpub\vhosts\enic-naric.net\statistics\webstat\AWStats\cgibin>perl awstats.pl -config=enic-naric.net
-DirData=C:\Inetpub\vhosts\enic-naric.net\statistics\logs\W3SVC32
-LogFile=C:\inetpub\vhosts\enicnaric.net\statistics\logs\W3SVC32\u_ex1309.log -year=2013
-month=09 -update

Note from pratik

Please refer to the following for statistics troubleshooting:


AWSTATS statistics:
---------0.) Check the logs are present on the server or not.
under %plesk_vhosts
%\domain_name\statistics\logs\W3SVC32\u_exYYMM.log or
u_exYYMM.log.zip
If present then:
1.) get the id and mant of the domain for which we need to recalculate statistics.
# dbclient.exe --direct-sql --sql="select id, name from domains
where name like '%domain_name%'"
say id = 27
2.)modify registry value:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Plesk\PSA
Config\Config\Statistics\DomainIds\27
---LastHttpStatisticsRun
---to date prior to the day from which we have to calculate statistics
for.
3.) Recalculate statistics using :
------statistics.exe --process-domains=domain_name --verbose
------****In case statistics are still not calculated:
4.) Go to this path
----C:\Inetpub\vhosts\proishunting.com\statistics\webstat\AWStats\cgibin>

Find location of log and direcotries http://kb.parallels.com/en/115152


and run below command to manually fetch data from logfile:
# perl awstats.pl -config=enic-naric.net
-DirData=C:\inetpub\vhosts\domain_name\statistics\webstat
-LogFile=C:\inetpub\vhosts\enicnaric.net\statistics\logs\W3SVC32\u_ex1309.log -year=2013
-month=09 -showcorrupted
# perl awstats.pl -config=enic-naric.net
-DirData=C:\Inetpub\vhosts\domain_name\statistics\webstat
-LogFile=C:\inetpub\vhosts\enicnaric.net\statistics\logs\W3SVC32\u_ex1309.log -year=2013
-month=09 -update
-----Note: perl module should be enabled for the subscription.
Make sure you have backup of the log directory before
executing daily maintenance script.
For linux:
---------http://kb.parallels.com/en/113693
C:\Program Files (x86)\Parallels\Plesk\admin\bin>statistics.exe
--http-web-stati
stics --process-domains=xilines-skales.gr --from-date="2007/09/01"

===PRODUCT/VERSION, OS/ARCHITECTURE===
OS version, architecture:
Window server 2012, 64 bit
Product version (including MU):
Plesk Panel 11.5.30
patch version=17
== PROBLEM DESCRIPTION ==

Awstats GEO IP functionality is not working for domains migrated


from Plesk 9.5 to 11.5.30. But it is working for newly created
domains.
We have also noticed by differency-checking the awstats.migratedsite.cong and awstats.new-site.conf that some very serious
differencies exist, like:
Different AWstats conf file version
Different syntax for loading various plugins
Different syntax for various awstats option
I attached config files of migrated and new created domains, so you
can see the difference
== STEPS TO REPRODUCE ==
Domain created in Plesk 11.5.30, GEOIP works:
Access "Visitors domains/countries" at http://agrofos.gr/pleskstat/webstat/index.html
Domain migrated from Plesk 9.5 to Plesk 11.5, GEOIP does not work:
Access "Visitors domains/countries" at http://xilines-skales.gr/pleskstat/webstat
===ACTUAL RESULT===
Awstats shows "?" and "unknown" while accessing statistics for
migrated site at: http://xilines-skales.gr/plesk-stat/webstat
===EXPECTED RESULT===
Awstats GEO IP functionality showing proper locations for migrated
domains from older versions.
===YOUR EXPECTATIONS FROM PLESK SERVICE TEAM===
Provide hotfix or fix issue in next Plesk version
===SUPPORT ACTIONS OF INVESTIGATION / RESOLVING===
I reproduced issue on other customer server who migrated Plesk for
Windows from Pelsk 9.5 to 11.5.30 as well
===POSSIBLE TEMPORARY WORKAROUND===

None
===LOGS AND ANY ADDITIONAL INFORMATION===
Customer does not provide us with migration logs. He told that issue
is reproducible for all migrated domains.

srv1:/var/www/vhosts/chic-trendy.de$ grep AWSTATS


/etc/psa/psa.conf
AWSTATS_ETC_D /etc/awstats
AWSTATS_BIN_D /var/www/cgi-bin/awstats
AWSTATS_TOOLS_D /usr/share/awstats
AWSTATS_DOC_D /var/www/html/awstats
srv1:/var/www/vhosts/chic-trendy.de$ rpm -qa|grep awstats
psa-awstats-configurator-10.12.0-cos5.build1012110525.15
awstats-6.95-11011213.swsoft
srv1:/var/www/vhosts/chic-trendy.de$ rpm -V awstats-6.9511011213.swsoft
..5....T c /etc/awstats/awstats.conf
S.5....T c /etc/awstats/awstats.model.conf
srv1:/var/www/vhosts/chic-trendy.de$ rpm -V psa-awstatsconfigurator-10.12.0-cos5.build1012110525.15
srv1:/var/www/vhosts/chic-trendy.de$
srv1:/var/www/vhosts/chic-trendy.de$ ps ax |grep collector
19953 pts/4 S+
0:00 grep collector
http://chic-trendy.de/plesk-stat/webstat/
mysql> select id from domains where name='chic-trendy.de';
+----+
| id |
+----+
| 55 |
+----+
mysql> select date, http_in, http_out from DomainsTraffic where

dom_id='55';
| 2013-12-18 |
| 2013-12-19 |
| 2013-12-20 |
| 2013-12-21 |
| 2013-12-22 |
| 2013-12-23 |
| 2013-12-24 |
| 2013-12-25 |
| 2013-12-26 |
| 2013-12-27 |
| 2013-12-28 |
| 2013-12-29 |
| 2013-12-30 |
| 2013-12-31 |
| 2014-01-01 |
| 2014-01-02 |
| 2014-01-03 |
| 2014-01-04 |
| 2014-01-05 |
| 2014-01-06 |
| 2014-01-07 |
| 2014-01-08 |
| 2014-01-09 |
| 2014-01-10 |
| 2014-01-11 |
| 2014-01-12 |
| 2014-01-13 |

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

2809796 |
2847486 |
2099211 |
1987369 |
704203 |
2968502 |
512725 |
827150 |
1482386 |
1533429 |
332027 |
3155147 |
1036086 |
576746 |
529582 |
1289097 |
2292992 |
212857 |
2953061 |
1644129 |
1453494 |
2326622 |
2597110 |
1451171 |
384091 |
1657071 |
2313996 |

You might also like