RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Analyze Your IIS6 Web Logs with AWStats

Need to know what your Web site users are visiting in your sites? Try this free and open source Web log analyzer you can use with IIS6-hosted Web sites and applications.

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 expensive—usually 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 reports—not the full-featured, interactive, and special-effect-filled reports generated by costly commercial software—but 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.

Installing AWStats
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 it—you 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, tools, 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 folder.

Here's the rest of the prodedure:

  1. 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.
  2. From that same folder, also copy the file awstats.pl.
  3. Next, copy the awstats_buildstaticpages.pl file from the \tools folder.
  4. 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.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date