Advanced Web Statistics
AWStats reads the raw Apache logfiles and parses them to give you detailed information about visitors.
Setup
- Download the tarball and unpack it into
/usr/local/awstats
- Make new directory
/var/lib/awstats
to store the data. - Run
/usr/local/awstats/tools/awstats_configure.pl
to setup initial configuration. - Create
awstats
HTML directory - Create an awstats configuration file
- Setup apache
- Setup cron job
- Build stats
./tools/awstats_configure.pl
Awstats configuration script
Ubuntu:
> /etc/apache2/httpd.conf > y > domain.com > [Enter for default]
Creates file /etc/awstats/awstats.domain.com.conf
Update stats:
/usr/local/awstats/wwwroot/cgi-bin/awstats_updateall.pl now
Apache Configuration
Copy /usr/local/awstats/webroot to wherever the awstats docs are viewable.
Alias /awstats "/var/www/localhost/htdocs/awstats" <Directory "/var/www/localhost/htdocs/awstats"> AllowOverride None Options None Order deny,allow Deny from all Allow from 173.165.130.129 Allow from 127.0.0.1 </Directory>
CPanel Integration
On some CentOS installations, with CPanel installed, you'll need to edit a specific file to get the AWStats alias working:
/usr/local/apache/conf/includes/post_virtualhost_global.conf
AWStats Configuration
You can use the sample config above, or use the config script to create a new one. Here are some configuration variables you are most likely to want to change:
- LogFile=“/usr/local/awstats/tools/logresolvemerge.pl /var/log/apache2/*_log”
- DetailedReportsOnNewWindows=0 (removes _target in links)
- LogFormat=1 (combined)
- LogFormat=4 (common)
Initial Run, Cron Job
You will need to run the awstats script to build the stats at least once.
Also, you can setup a cron job to execute it nightly.
/usr/local/awstats/tools/awstats_buildstaticpages.pl -config=dev.beandog.org \ -update -dir=/var/www/localhost/htdocs/awstats &> /dev/null