Analyzing IIS6 Web Logs With AWStats

By Bruno Zambetti (Send Email)
Posted Dec 14, 2005

Web server logs are a powerful resource for extracting information about Web sites and applications. When logging is enabled, Web servers log information about each request. Analyzing the logs reveals information 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.

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.

Because log analysis is so important, many commercial software applications create useful and good-looking reports. Unfortunately, most are also very expensive. 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 an inexpensive and fast solution that isn't terribly resource-intensive.

Fortunately, 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 costly commercial software generates — but still useful, with all the important data presented tastefully. It is also very fast, and it 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 on request. The second is "offline" mode, in which AWStats analyzes data and creates static reports as HTML pages publishable via any standard Web server.

This article discusses how to install and use AWStats only in offline mode, which is preferable because it minimizes security risks and resource usage, so as to not undermine Web server performance. For example, report generation is scheduled in offline mode to run during off-peak hours.

This article also looks at how to install AWStats, analyze logs, and publish generated reports from IIS 6 log files. Code referenced in this article is available for download.

Installing AWStats

To install AWStats on Windows, 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, as you don't need it to run AWStats in offline mode However, if you do want to run AWStats (or other Perl scripts) online, go ahead and install it.

Next, download AWStats, which as of press time is in version 6.4.

Author's Note: 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, 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, 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:myAppsawstats-6.4bin 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 procedure:

  1. Copy to bin the folders named css, icon, lang, lib, and plugin from the wwwwrootcgi-bin folder created when you unzipped the AWStats download.
  2. From that same folder, copy the file awstats.pl.
  3. Next, copy the awstats_buildstaticpages.pl file from the tools folder.
  4. Finally, create a bindirdata 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 also use the bin folder to hold the configuration files defined later in this article as well as batch scripts to automatically run the application.

>> AWStats' Structure

This article was originally published on DevX.com.

Page 1 of 4

Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.



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