eb server logs are a powerful resource for extracting information about your Web sites and applications. When logging is enabled, Web servers log information about each request. By analyzing these logs you can gain knowledge about which resources are popular, what kinds of browsers people are using, how much bandwidth a Web site consumes, the request trend during a given time span, and so on.
Because log analysis is so important, there are many commercial software applications that create useful and good looking reports. Unfortunately, they're often also very expensiveusually out of budget range for people with small sites. In addition, some log analyzers have a performance impact on the server itself. For example, recent WebTrends (one of the more popular commercial packages) versions require considerable RAM and processor time. If you can't afford to devote an entire server to Web log analysis and report creation, then you need a cheap and fast solution that isn't terribly resource-intensive. You're lucky; such as solution exists, and its name is AWStats
AWStats is a free, open source log analyzer. It can analyze a wide variety of logs, and it creates good reportsnot the full-featured, interactive, and special-effect-filled reports generated by costly commercial softwarebut still useful, with all the most important data, presented tastefully. It is also very fast, and doesn't consume many resources. In fact, most of the time, AWStats doesn't consume any resources at all.
AWStats is a Perl application with a simple structure. It requires an interpreter that can execute Perl scripts and has a small footprint on the server. The Perl source is neither very clear nor particularly readable, so it's not easy to change the behavior of the software; but you can use it "as is" for most common needs.
AWStats works in two modes. The first is interactive, or "online", mode. When used in online mode, AWStats updates its reports only when a user requests it. The second is the "offline" mode, in which AWStats analyzes data and creates static reports as HTML pages publishable via any standard Web server.
In this article, you'll see how to install and use AWStats only in offline mode, which is preferable, because it both minimizes security risks and resource usage, so it doesn't undermine your Web server's performance. In offline mode you schedule report generation during off-peak hours and avoid running it during busier times.
You'll see how to install AWStats, analyze logs, and publish generated reports from IIS6 log files.
To install AWStats on Windows, you need to download a Perl interpreter (if you don't already have one) and the AWStats software (scripts). I recommend ActivePerl 5.8, which you can download from http://www.activestate.com/ for free. ActivePerl 5.8 installs using a standard MSI installation. During the installation process, you have the option of installing an ISAPI Perl extension, but I recommend not installing ityou don't need it to run AWStats in offline mode as discussed in this article. However, if you do want to run AWStats (or other Perl scripts) online, go ahead and install it.
Next, download AWStats (currently at version 6.4).
|Author's Note: You need to be aware that earlier AWStats versions have known security problems, so if you're already running AWStats and haven't updated to the latest version, you should do so immediately. If you're planning to install AWStats, make sure you get the latest version before performing the install.
The download is a .zip
file that you can expand wherever you want. The AWStats .zip
file contains three folders: docs
, and wwwroot
. I suggest deleting the docs
folder (you can find documentation online, or you can copy it on your workstation, but you don't need it on your production server). Next, I suggest you create a new folder where you will copy only the files you really need to run AWStats, both to minimize the installation complexity and to create a "personal distribution" of the software. For example, you can create an E:\myApps\awstats-6.4\bin
folder. This is the folder I've used for the sample application
; I'll refer to it from here on out as simply the \bin
Here's the rest of the prodedure:
- Copy to \bin the folders named css, icon, lang, lib, and plugin from the \wwwwroot\cgi-bin folder created when you unzipped the AWStats download.
- From that same folder, also copy the file awstats.pl.
- Next, copy the awstats_buildstaticpages.pl file from the \tools folder.
- Finally, create a \bin\dirdata folder that you'll use to manage AWStats' databases.
That's it; you don't need any of the other files and folders from the download to run AWStats in offline mode.
You'll use the \bin folder to hold the configuration files defined later in this article as well as batch scripts to automatically run the application.