Tested with Ubuntu server 8.04 (Hardy Heron).
sudo aptitude install awstats
To see the country of your visitors (not required)
sudo aptitude install libnet-ip-perl sudo aptitude install libgeo-ipfree-perl
Let's assume you want to analyze the Apache 2 log file of your website “toto.com” (It can be just an IP address).
Create configuration file
sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.toto.com.conf
Update these parameters
# apache2 LogFile="/var/log/apache2/access.log" # domain name SiteDomain="toto.com" HostAliases="localhost 127.0.0.1 toto.com" LogFormat=1
You can also activate these plugins
LoadPlugin="tooltips LoadPlugin="geoipfree"
sudo /usr/lib/cgi-bin/awstats.pl -config=toto.com -update
You should get something like this
Create/Update database for config "/etc/awstats/awstats.toto.com.conf" by AWStats version 6.7 (build 1.892) From data in log file "/var/log/apache2/access.log"... Phase 1 : First bypass old records, searching new record... Searching new records from beginning of log file... Phase 2 : Now process new records (Flush history on disk after 20000 hosts)... Jumped lines in file: 0 Parsed lines in file: 191338 Found 0 dropped records, Found 24 corrupted records, Found 0 old records, Found 191314 new qualified records.
Create /etc/apache2/conf.d/statistics
Alias /awstatsclasses "/usr/share/awstats/lib/" Alias /awstats-icon/ "/usr/share/awstats/icon/" Alias /awstatscss "/usr/share/doc/awstats/examples/css" ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ScriptAlias /statistics/ /usr/lib/cgi-bin/ Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Restart Apache
sudo /etc/init.d/apache2 restart
View your statistics
or (in case you have more than one config file)
In /etc/crontab add
# update every 10 min */10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=toto.com -update > /dev/null
Just delete the files in /var/lib/awtstats (directory defined by DirData parameter)
sudo su - root cd /var/lib/awstats rm * logout
Notes
sudo rm -R awstats/* wouldn't work.Never updated (See 'Build/Update' on awstats_setup.html page) whereas the awstats files are there in /var/lib/awtstats, it's probably a permission problem on this folder. Source: http://awstats.sourceforge.net/docs/awstats_faq.html#RESET
awstats "Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats. "
Try to this URL (with your values): http://toto.com/statistics/awstats.pl?config=toto.com