Statistics Management
- Written by Vanessa Vasile
- Published in Apache, Apps, Howto
- Permalink
One of the more important features to customers is the ability to view and analyze their web traffic. CPanel offers three statistics programs for end users to view their stats, all of which are free and open source:
- Analog
- AwStats
- Webalizer
Configuring Stats
In WHM, go to Statistics Software Configuration and select which statistics programs to enable. The go to WHM > Tweak Settings as well and check the same stats programs under “Stats Programs“. Usually though checking them in one place or the other will enable them in both places.
You also want to set the update frequency of the logs, usually to 24 hours. You can check the box for allowing Awstats override configuration files as well, so that users will have their own awstats.conf they can modify in their tmp folders.
With this, you'll need to verify into WHM > Tweak Settings the following value:
Number of days between processing log files and bandwidth usage (default 1, decimal values are ok)
Again, the Tweak settings and stats configuration are essentially the same setting, so updating one should update them both.
Now that stats will be running on a normal schedule, you can make additional configurations. In WHM > Tweak Settings, go to the Stats and Logs section and you'll find a number of settings that you can configure:
- Allow users to update Awstats from cPanel – This will put an 'Update Now' link in awStats for each user so they can run their own stats. Keep in mind that if you enabled the local Awstats config for users, they can override this setting.
- Delete each domain's access logs after stats run – If this is checked, the domain's stats in /usr/local/apache/domlogs will be removed after each stats run
- The load average above the number of cpus at which logs file processing should be suspended (default 0) – What server load will caused the stats to stop running
- Awstats Reverse Dns Resolution – This resolves IPs in Awstats to hostnames. This can degrade performance on more populated servers, but seems to be preferred by end users.
Managing Stats
You can set time exclusions to indicate when stats should not be running. This is useful for servers that tend to have higher load during the day. To enforce this restriction, edit /etc/stats.conf and set:
BLACKHOURS=8,9,10,11,12,13,14,15
In that example, stats will not run between 8am and 3pm.
In WHM > Statistics Software Configuration, you can see if your server's stats are running properly. If they are, you should see this:
The server currently is able to keep up with your statistics processing schedule.
If the message says otherwise, and your stats are not up to date, you may need to make changes to how you are running your statistics. Meaning, if you have a lot of users on the server, you may want to consider making one or more of the following changes:
- Narrow the blackout hours (if specified)
- Increase the load limit for processing stats in WHM > Tweak Settings
- Change the frequency in which logs are being run, to allow more time
You may also want to see if there are any very large logs files in /usr/local/apache/domlogs, that could be taking a long time to run. You may want to consider moving that user to another server or running their stats manually via cron job at a certain time every day.
To run a user's stats manually, you can use WHM > Statistics Software Configuration, or use:
/scripts/runweblogs
If stats have not been updating at all, it's possible that cpanellogd isn't running. Try restarting cPanel, and run /scripts/runlogsnow