awstats - Simple Network Management

Awstats - Simple Network Management Protocol

[Ref: Awstats]

Quick notes for installing AWSTATS within my environment:

Download the awstats files and extract to a known directory

export SRC=/path/to/awstats-7.1.1

cd $SRC

Set the appropriate permissions that we will require for using the files (such as other readable for the perl scripts, and ‘x’ for the directories:

find . -type d -print -exec chmod +x “{}” “;”

find . -type f -print -exec chmod +r “{}” “;”

Move the files into the appropriate locations for how we manage our websites.

mv tools /usr/local/awstats

mv wwwroot /var/www/awstats

mkdir -p /etc/awstats

mv /var/www/awstats/cgi-bin/awstats.model.conf /etc/awstats/

mkdir -p /var/db/awstats

Set at least one perl script as executable

chmod + /usr/local/awstats/

Run the configuration to create some configuration files


perl /usr/local/awstats/

Responses to prompt for httpd.conf:

Note that installation will make some modifications that will need review.

Awstat Configuration Updates

We’re using a path different from the standard install, and need to update the appropriate perl scripts:

File extract: /usr/local/awstats/ and /usr/local/awstats/

my $Awstats=‘/var/www/awstats/cgi-bin/’;

Likewise, the default configuration template awstat.model.conf and all our configuration files need to be updated to reflect the below:

File extract: /etc/awstat/awstat.model.conf

DirData=“/var/db/awstats” DirCgi=“/awstats” DirIcons=“/awstatsicons”

Example customisation for our squid cache include:

File extract: /etc/awstat/awstat.squid-cache.conf


Apache Configuration Update

File: /var/www/conf/modules/awstats.conf


Directives to allow use of AWStats as a CGI

# Alias /awstatsclasses “/var/www/awstats/classes/” Alias /awstatscss “/var/www/awstats/css/” Alias /awstatsicons “/var/www/awstats/icon/” ScriptAlias /awstats/ “/var/www/awstats/cgi-bin/” #

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

# Options None AllowOverride None Order allow,deny Allow from all

Root Cron Job

/usr/local/awstats/ now


Apache needs to run in chroot for a number of reasons, including:

Squid Access Log Format

File extract: /etc/squid/squid.conf

logformat combined %>a %ui %un [%tl] “%rm %ru HTTP/%rv” %Hs %h” “%{User-Agent}>h” %Ss:%Sh access_log /var/squid/logs/access.log combined