Setup AWStats on IIS

AWStats is a great tool for parsing web server access logs of any kind.  If you are not familiar with it, I recommend checking out the Live Demo to see what kind of data it can provide. I’ve been using it for a long time to provide stats on all sorts of different websites and applications (including PeopleSoft). It’s just another great tool for in any Admin’s toolbox.  Normally I run it on Linux but recently I setup AWStats on IIS which was actually pretty painless.  Here is what I did.

What you need:
IIS, Perl, AWStats

If IIS is not already installed, install it, making sure the CGI and ISAPI Application Development options are installed.  I chose to use Strawberry but ActivePerl is an option for your Perl install as well.  Install your choice.  unzip AWStats somewhere, I will refer to this location as %AWSTATS_HOME%.

virtual dirI had an existing site that was a launchpad for admin functions that I was adding AWStats to so I created a new virtual directory named awstats and pointed it to my awstats %AWSTATS_HOME%\wwwroot path.  If you were starting from scratch, you could just make wwwroot the real site root.

In IIS under the Handler Mappings config add a Script Map for your AWStats site.  It should map *.pl files to be run by Perl.script map

Once that is done it’s on to AWStats specific configuration.  Run the awstats_configure.pl script answering the prompts to build your basic config file.
perl %AWSTATS_HOME%\tools\awstats_configure.pl

I entered:
none – for apache path,
Y – to create a new config,
HCMDEV – as the site name
ENTER – notification to use schedule tasks
ENTER – to finish

 

Edit the config file created you just generated from the configure script (%AWSTATS_HOME%\wwwroot/cgi-bin\awstats.<name>.conf)

Somewhere near line 50 you can specify LogFile path and name. Unless you’ve changed the filename it’s going to be something like %PS_HOME%\webserv\HCMDEV\servers\PIA\logs\PIA_access.log
Change LogFormat from 1 to 4; Weblogic should default to the Common format.
In my case I also updated DirCgi and DirIcons to reflect the /awstats/ virtual directory in my URL

Run the awstats.pl script to generate your stats
perl %AWSTATS_HOME%\wwwroot\cgi-bin\awstats.pl -config=HCMDEV

Then hit your AWStats site to see if it worked.
http://mgmtsite.yourco.com/awstats/cgi-bin/awstats.pl?config=HCMDEV

Of course, this requires that the access logging actually be enabled in WebLogic which is done by logging into the console, navigating to Environment -> Servers -> server instance -> Logging Tab -> HTTP sub tab, and selecting HTTP Access Log File Enabled.  I normally set up the file to roll by time rather than size and keep them a while longer.  If they are really big I use a script to compress and move them for a month or more.  Then you can schedule AWStats to read the old log file daily after it rolls.  I don’t normally use AWStats as a real-time monitor so I don’t usually read the live access log.


Posted

in

, ,

by

Tags:

Comments

2 responses to “Setup AWStats on IIS”

  1. Edward Avatar
    Edward

    Hi, I’ve followed your guide thoroughly and I’ve had no trouble. However, is it possible to install AW Stats, IIS 7 and Strawberry Perl in the app server ow Weblogic Server?

    When I try to connect to to server, I apparently need a physical access path. Which I don’t know.

    I need to add Aw Stats to my DEV environment and, later on, to the testing and product environment. Please help

    1. Randy Avatar

      Hi Edward, I’m not sure I understand what you are asking? In the scenario above, I installed Perl and AW Stats onto a Windows server that already had IIS 7 installed. This server was also the Weblogic Server.

      I would think it is possible to run the AW Stats perl scripts straight from Weblogic. However I prefer to not add external functionality like this into the Weblogic instance for the PIA.

Leave a Reply

Your email address will not be published. Required fields are marked *