plainblack.com
Username Password
search
Bookmark and Share
Subscribe

Configuring AWStats

Using AWStats

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.

Setting up AWStats under WRE

  1. Run wreconsole.pl
  2. Select Settings tab from WRE Console app
  3. Find the "Web Statistics" section, enable statistics and configure for your server's domain name.
  4. Save changes
  5. Restart modproxy server

Accessing your AWStats site

Your stats will be available at http://stats.example.com/?config=www.site.com

Updating the stats for a site

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

Disable email output from cron jobs

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

Customizing your AWStats configuration file

Setting up a default page

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.

Simplify access with rewrite rules

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

Create a link from client domain

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.

Add support for client subdomains

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>

Tracking screen resolution

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

Search | Most Popular | Recent Changes | Wiki Home
© 2014 Plain Black Corporation | All Rights Reserved