AWStats is "a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically." It is included as part of the WRE but is not enabled by default.
Your stats will be available at http://stats.example.com/?config=www.site.com
To update the stats for a specific site, use the following:
/data/wre/prereqs/wwwroot/awstats.pl -config=YOURSITE -update
Note that by default, the stats run against access.log.0 which is the logfile from the previous day. You can change this setting in the awstats conf file (LogFile).
To update the stats for all sites:
/data/wre/prereqs/tools/awstats_updateall.pl now -awstatsprog=/data/wre/prereqs/wwwroot/awstats.pl -configdir=/data/wre/etc
To disable all output (STDERR and STDOUT) add the following to your awstats_updateall and logrotate cron jobs:
> /dev/null 2>&1
To disable only STDOUT while getting notifications of errors add the following:
> /dev/null
The above steps will create a /data/wre/etc/stats.modproxy file. The default configuration file results in a verbose error message if a visitor goes to the domain by itself. Add the following rewrite rules to the configuration to output a message that doesn't reveal potential server configuration details.
# Handle requests to domain
RewriteEngine on
RewriteRule ^/$ /index.html [L]
You'll also need to add an index.html file to your /data/wre/prereqs/wwwroot folder.
Use the following rules to simplify access to your stats server to be http://stats.example.com/www.site.com:
RewriteCond %{REQUEST_URI} !/icon
RewriteCond %{REQUEST_URI} !/awstats
RewriteRule ^/(.*) /awstats.pl?config=$1
To create a link from the client's domain to the stats file, add a Redirect to the client modproxy conf file such as the following:
# Awstats link
RewriteRule ^/_stats - [L]
RedirectPermanent /_stats http://stats.example.com/www.site.com
This rule would redirect www.site.com/_stats to the your AWStats server.
It's possible to add support for client subdomains using additional virtualhost settings, such as stats.sitename.com. I add these into the stats.modproxy file for easy management. Here's an example:
<VirtualHost *:80>
ServerName stats.sitename.com
DocumentRoot /data/wre/prereqs/wwwroot
RewriteEngine on
RewriteRule ^/$ /awstats.pl?config=www.sitename.com
</VirtualHost>
With a little plug-in magic, AWStats is able to track screen resolution of visitors along with other browser capabilities. See the AWStats FAQ-COM142.
Keywords: awstats statistic wre configure