Basic awstats configuration
<yambe:breadcrumb self="Basic awstats configuration">Awstats configuration|Awstats configuration</yambe:breadcrumb>
Basic awstats configuration
awstats can be used to analyze the traffic pattern of the website. This can help in identifying main entry and exit points for users. It can also help in identifying from which IPs are most requests coming, what are commonly used browsers used to access the site, what client operating systems are being preferred and so on.
Installation
We can install awstats using 'yum' or similar package management tool in any standard Linux distribution.
Configuration
There is usually a sample configuration file in '/etc/awstats' folder for localhost. We can copy the file and change parameters for apache VirtualHosts hosted on current system. The parameters that are likely to be changed are:
- LogFile
- This is name of apache 'VirtualHost CustomLog' file. This log file must be in 'combined' format and not in 'common' format. If we use 'common' format for logging then we have to modify the awstats configuration file appropriately to expect different set of values in log file.
- SiteDomain
- This is the main domain of website like 'www.sbarjatiya.in'
- HostAliases
- These are other aliases of server like 'sbarjatiya.in mail.sbarjatiya.in' etc.
- AllowAccessFromWebToFollowingIPAddresses
- These are the addresses which can see awstats output for particular domain / awstats configuration file. This makes sure that only administrators of site can see the statistics and not everyone.
The name of configuration file is of format 'awstats.<site_name>.conf' and present in /etc/awstats directory. Lot of changes get reflected immediately without requiring reloading of apache web server.
Process apache logs
Awstats processes logs every hour by cron script in '/etc/cron.hourly' folder. If we want to test the configuration after we have setup awstats for new server, we can process the logs manually using command:
perl awstats.pl -config=<site_name> -update
The advantage of running this manually is we can see if settings are proper and that awstats can read the log file and that log file is in proper format etc.
Seeing the output
To see the output we can open URL 'http://<IP>/awstats/awstats.pl?config=<site_name>' from IPs which are allowed in configuration file to see statistics of this site.
<yambe:breadcrumb self="Basic awstats configuration">Awstats configuration|Awstats configuration</yambe:breadcrumb>