Revision of AWStats from Thu, 05/27/2010 - 15:47

Revisions allow you to track differences between multiple versions of your content, and revert back to older versions.

AWStats is an open source Web analytics reporting tool, suitable for analyzing data from Internet services such as web, streaming media, mail and FTP servers. AWstats parses and analyzes server log files, producing HTML reports. Data is visually presented within reports by tables and bar graphs. Static reports can be created through a command line interface, and on-demand reporting is supported through a web browser CGI program.

Requirements

Installation
Download the latest stable release:

cd /extra/src
wget http://internap.dl.sourceforge.net/sourceforge/awstats/awstats-6.95.tar.gz
tar zxf awstats-6.95.tar.gz

Move the files to the "standard" AWStats directory on a Linux OS (/usr/local/awstats):

mv awstats-6.95 /usr/local/awstats

Run the included configuration script:

cd /usr/local/awstats/tools
./awstats_configure.pl

The AWStats install documentation gives details on the questions the configuration script will ask you.
Take note of what the configuration file gives you about your particular install - it has the proper options to use for updating your stats with cron, and for accessing the stats from your webserver.

Apache Configuration
AWStats didn't add the directives to the Apache install automatically, so these needed to be added to /usr/local/apache2/conf/extra/httpd-vhosts.conf for a VirtualHost:

<VirtualHost *:80>
ServerName stats.mydomain.com
DocumentRoot /usr/local/awstats/wwwroot
CustomLog /var/log/stats.mydomain.com_accesslog combined
ErrorLog /var/log/stats.mydomain.com_errorlog

## Directives to allow use of AWStats as a CGI

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

## This is to permit URL access to scripts/files in AWStats directory.

<Directory "/usr/local/awstats/wwwroot">
  Options None
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

## This is to allow access to the cgi-bin folder
<Directory "/usr/local/awstats/cgi-bin">
  Order allow,deny
  Allow from all
</Directory>
</VirtualHost>

It's recommended that your Apache access log file be written in the combined format. That format is already configured in httpd.conf, but you'll probably have to change the CustomLog parameter to disable the "common" and enable "combined" for Apache's default log files.
If you configure your virtual hosts to use custom log files, be sure to set those to "combined" as well.

AWStats Manual Configuration
The config file in /etc/awstats that is created by awstats_configure.pl probably needs some manual tweaking to reflect the server you want to analyse. Particular values that you should be looking at are:

  • LogFile - should be the full path to your server log file
  • LogType - should be "W" for web log files
  • LogFormat - should be "1" unless you are using a custom log format
  • SiteDomain - set this to the main domain name used to connect to the site you are analysing. If you have multiple names you connect to that site with, add them to the HostList parameter
  • DirData - where you want the analysis results to be stored

The rest of the configuration parameters are detailed here.
If you use the default DirData value of /var/lib/awstats, you'll need to create that directory:

mkdir /var/lib/awstats

Initial Statistics Database Build
It's recommended that the first log analysis be done manually from the command line since it may take a long time to process the log for the first time.
The command to do it is:

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=mysite -update

Where "mysite" is the domain/virtual host name you set for in your initial run of the configuration script.

Building and Viewing the Reports
To dynamically view your statistics from a browser:

http://<myserver>/awstats/awstats.pl?config=mysite

If you want to build static reports, the AWStats documentation explains how to do it.
Updating the stats
If you want to be able to update the stats from the dynamically generated web reports, set the AllowUpdateStatsFromBrowser parameter to "1" in the configuration file. You'll probably also have to give write permission to your DirData so that the Apache daemon can write to it.

Stats can be automatically updating using cron. The following command will update the stats

/usr/local/awstats/tools/awstats_updateall.pl now

Advanced Configuration
Exclude the 123.123.123.xxx subnet from the statistics:

SkipHosts="REGEX[^123\.123\.123\.]"

Recent Updates

  • 11 months 1 week ago
    1.27.2 update
  • 11 months 3 weeks ago
    Drupal 10/11 config
  • 11 months 3 weeks ago
  • PHP
    11 months 3 weeks ago
    PHP 8.3.11 and AlmaLinux
  • 11 months 3 weeks ago
    New version of Pound
Error | Production Monkeys

Error

The website encountered an unexpected error. Please try again later.