AWStats is short for Advanced Web Statistics. AWStats is powerful log analyzer which creates advanced web, ftp, mail and streaming server statistics reports based on the rich data contained in server logs. It updates regularily, typically on daily basis, and provides an excellent graphical representation for easy understanding. More details about the tool are available from the documentation.
AWStats is widely employed in cPanel servers. To access AWstats from cPanel, please login to cPanel and then navigate then cPanel >> Metrics >> AWStats. But you may get into instances where AWStats fails to update itself on the web UI (cPanel >> AWStats). There are a lot of reasons as of why the stats are not being updated which can include incorrect file permissions or configuration changes.
I am pointing the common reasons why the stats can fail to update and will add more reasons when I come across them.
How to update AWStats manually
If Awstats not updating automatically then obviously you will have to update it manually. This can be done from cPanel or command line and the option to choose depends on your choice/preference. You need root access to the server for updating AWStats manually.
From Command Line
To update Awstats for a user alone via command line, run the command below after logging to the server as ‘root’ user.
/scripts/runweblogs $user-name
Of course, you will have to replace $user-name with the username of the cPanel account.
Example:
root # /scripts/runweblogs <user_name>
Log checker loaded ok..
==> cPanel Log Daemon version 26.0
——[2016-04-17 01:15:57 -0400] Reading history file… webalizer.hist
[2016-04-17 01:15:57 -0400] Reading previous run data.. webalizer.current
[2016-04-17 01:15:57 -0400] Saving current run data… [04/17/2016 01:12:09]
[2016-04-17 01:15:57 -0400] Generating report for April 2016
[2016-04-17 01:15:57 -0400] Saving history information…
[2016-04-17 01:15:57 -0400] Generating summary report
[2016-04-17 01:15:57 -0400] 252 records in 1 seconds, 252/sec
[2016-04-17 01:15:58 -0400] Complete
WHM
If you are choosing to update Awstats manually via WHM, you can do it by navigating to WHM
Home »Server Configuration »Statistics Software Configuration
and then select the user to update stats from the drop down and fire the statistics to be processed by hitting the ‘Go’ button.
If it still fails, then the issue is something deeper and we need to investigate further.
Reasons why AWStats fails to update automatically
There are many reasons as of why even a manual stats update can fail. As mentioned earlier, various statistics shown here are derived from various log files. For eg: it uses the entries in the domlogs file for web traffic calculation. Same is the case with other services like IMAP, POP etc. Awststs can stop working if there is any issues with permissions or ownership of the log files, binary file or with the cPanel specific configurations for stats update.
Let us check the issue further through the steps given below
1. SSH to server as root user.
2. Change the directory to:
cd /home/username/tmp/awstats
Where username is the cPanel username of the account in question. The configuration files for domains under that particular cPanel account are located here.
The directive “AllowToUpdateStatsFromBrowser” is to be set to 1 for Awstat to be updated from the cPanel interface.
Fire the below command to list the conf files present.
#ll *.conf root@server [/home/user/tmp/awstats]# ll *.conf -rw-r--r-- 1user user 23753 Apr 17 01:15 awstats.domain.com.conf
We have identified the stats configuration file for the domain under evaluation. For the purpose of anonymity I am using “domain.com” here, it should be replaced with the actual domain name being investigated.
# grep AllowToUpdateStatsFromBrowser awstats.domain.com.conf # Warning: If you want to be able to use the "AllowToUpdateStatsFromBrowser" AllowToUpdateStatsFromBrowser=1
Also please check the permission of “/usr/local/cpanel/3rdparty/bin/awstats.pl” file. It must be 775.
# ll /usr/local/cpanel/3rdparty/bin/awstats.pl -rwxrwxr-x. 1 root root 679172 Aug 23 2009 /usr/local/cpanel/3rdparty/bin/awstats.pl*
WHM Panel;
Home » Server Configuration » Statistics Software Configuration
Check if Awstats is enabled in the options ‘Generators Configuration” there.
Once the stats are processed again, check the same via Awstats panel and confirm everything is working as it should be