Installation
- yum install awstats
- yum install perl-Geo-IP
- yum install GeoIP-data
Configure Awstats
You’ll need to edit /etc/awstats can copy one of the examples there.
The configuration files take the form:
awstats.hostname.conf
Naming the configuration file with the correct hostname is important as awstats cgi will refer to this hostname if you setup a virtualhost for accessing statistics
The most important lines in the configuration files are:
The location of the log file:
LogFile="/var/log/httpd/knowledge.oscc.org.my/access.log"
Your site domains:
SiteDomain="knowledge.oscc.org.my" HostAliases="kb.oscc.org.my"
Where awstats keeps it’s summarised data:
DirData="/var/www/awstats/data"
If you rotate or delete your logs, you only need the above data directory to keep the historical summary data for awstats .
Configuring GeoIP
Country statistics are quite important for government and international agencies to find out which countries are accessing their sites. Uncomment the following line and add the data as below:
LoadPlugin="geoip GEOIP_STANDARD /var/lib/GeoIP/GeoIP.dat"
Running Updates
Awstats needs to parse and update your logfiles for the data, you’ll need to run the updates program manually.
/var/www/awstats/awstats.pl -update -config=stats.knowledge.oscc.org.my
The config file is the configuration file for your hostname you wish to access the statistics from. Most admins would probably want to run this in crontab.
Accessing in Apache httpd server
By default, the configuration for awstats is already installed to access via your localhost. See /etc/httpd/conf.d/awstats.conf to see the lines for which you can copy to create a virtual host to access statistics.