AWStats Quickstart Guide

, No Comments »

AWStats is a free web analytics reporting tool, suitable for analyzing data from Internet services such as web, 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.

Installing AWStats

To install AWStats I chose to download the package from the http://awstats.sourceforge.net/ website instead of installing it through the Ubuntu package manager. The reason behind this was because I felt the directory structure created by the Ubuntu package manager was too messy. AWStats recommend to install the package inside the /usr/local/awstats directory, however I decided to put it in /opt and create a symbolic link instead.

$ cd /opt
$ wget http://prdownloads.sourceforge.net/awstats/awstats-6.6.tar.gz
$ tar -zxvf awstats-6.6.tar.gz
$ ln -s awstats-6.6 awstats

Configuring AWStats

AWStats can be configuring using an automated script or manually. To configure AWStats using the automated script using the following command:

$ /opt/awstats/tools/awstats_configure.pl

The following are the steps to configure AWStats manually:

Setup Virtual Host for Apache

<VirtualHost>
    DocumentRoot /opt/awstats/wwwroot
    #
    # Directives to allow use of AWStats as a CGI
    #
    Alias /awstatsclasses "/opt/awstats/wwwroot/classes/"
    Alias /awstatscss "/opt/awstats/wwwroot/css/"
    Alias /awstatsicons "/opt/awstats/wwwroot/icon/"
    ScriptAlias /awstats/ "/opt/awstats/wwwroot/cgi-bin/"
    #
    # This is to permit URL access to scripts/files in AWStats directory.
    #
    <Directory>
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Creating a Config/Profile for AWStats

Creating a new configuration file in /etc/awstats by copying the template awstats.model.conf. Where mysite is the profile name.

$ cp /opt/awstats/wwwroot/cgi-bin/awstats.model.conf /etc/awstats/awstats.mysite.conf

The configuration file awstats.mysite.conf contains numerous parameters. To have AWStats configured correctly for your profile the following parameters must be verify correctly.

  • LogFile The path to the server log file.
  • LogType The log file type “W” is for web log file.
  • LogFormat The log format “1″ is for Apache combined log format.
  • SiteDomain The domain name of the website.

Other useful parameters are:

  • DNSLookup Make reverse DNS lookups, “1″ DNS Lookup is fully enabled
  • SkipHosts Do not include access from clients that match following criteria

For more information on all the parameters refer to http://awstats.sourceforge.net/docs/awstats_config.html

Running/Building Statistic Database

It’s recommend to run/build the statistic database from the command line:

$ /opt/awstats/wwwroot/cgi-bin/awstats.pl -config=mysite -update

By default the statistic database is located in the directory /var/lib/awstats, but can be changed with the DirData parameter in the configuration file.

If log file rotation is implemented for your server, for example on a monthly basis, then there is a chance the last couple of visits from the preivous log file might not be included during the database update. You can run AWStats to override the log file that is defined configuration file.

$ /opt/awstats/wwwroot/cgi-bin/awstats.pl -config=mysite -LogFile=/path/to/previous/month/logfile

The update process can only accept files in chronological order, so if you have already processed a recent file, you must delete all the statistics database in /var/lib/awstats that is newer than the log file specified in the above command.

Viewing AWStats Reports

AWStats can generate static HTML reports or dynamically with their CGI program. To view reports dynamically, point your browser to http://www.example.com/awstats/awstats.pl?config=mysite

For more information refer to the AWStats documentation.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in