MS LogoThere are heaps of ways to track website traffic hits depending on your requirements, platform and of course budget. One of the most popular methods of tracking statistics is through services such as Google Analytics however log file analysis remains the most reliable way to track your visitors as they are immune to script blockers.

I am familiar with AWStats on Apache as such I decided to use it on Microsoft IIS, this is a how to guide on installing it.

In order to capture data, AWstats requires you to log the following fields:

  • date
  • time
  • c-ip
  • cs-username
  • cs-method
  • cs-uri-stem
  • sc-status
  • sc-bytes
  • cs-version
  • cs (User-Agent)
  • cs (Referer)

Microsoft IIS 7 Setup

  1. Open “Internet Information Servers (IIS) Manager”
  2. Select the top level for all your websites
  3. Click on “Logging”IIS Manager
  4. In the logging configuration page, set up a single log file per site which roles over faily using local time for the namingLogging Configuration
  5. Clcik “Select Fields” and select the followingW3C Logging Fields
    1. Date
    2. Time
    3. Client IP Address
    4. User Name
    5. Method
    6. URI Stem
    7. Protocol Status
    8. Bytes Sent
    9. Protocol Version
    10. User Agent
    11. Referer
  6. Click “OK”
  7. Click “Apply” on the right hand side

Setting up AWStats

  1. Download from Sourceforge here
  2. Download Perl from here
  3. Install Perl to default location
  4. Open command prompt
    1. cd c:Perl64
    2. ap-iis-config add all
  5. Create a folder called “awstats” in the folder root folder of the website you want to track
  6. Extract AWStats into the awstats folder you created
  7. Copy the “awstats.model.conf” file to a file named “awstats.domain.com.conf” (where domain.com is the site to track)
  8. Open the fole with Microsoft Wordpad (I found Notepad doesn’t format correctly)
  9. The first thing to configure is “LogFile=”
    1. C:Windowssystem32LogFilesW3SVC[IIS_ID] = Microsoft Windows 2003
    2. C:inetpublogLogFilesW3SVC[IIS_ID]
  10. You can find the IIS ID by looking at the master site listing in IIS ManagerW3SVC ID
  11. 11. Set the options in the configuration file. This file has a very good explanation of what each option does, the main configuration parameters that are required to make it work is as follows:
    1. LogFile=”C:inetpublogsLogFilesW3SVC1u_ex%YY-24%MM-24%DD-24.log” (Server 2008/IIS7 Stats calculated every day)
    2. Logfile=”C:WINDOWSsystem32LogFilesW3SVC1ex%YY-4%MM-4%DD-4.log” (Server 2003/IIS6 Stats calculated every 4 hours)
    3. LogFormat=”date time cs-method cs-uri-stem cs-username c-ip cs-version cs(User-Agent) cs (Referer) sc-status sc-bytes”
    4. SiteDomain=”domain.com”
    5. HostAliases=’www.domain.com domain.com 192.168.0.1” (All URLS you are going to use to connect to AWstats, use internal and external)
    6. DefaultFile=”index.php index.html”Once you have saved your configuration file, run the AWStats Perl Script to compile the stats data.
  12. Once you have saved your configuration file, run the AWStats Perl Script to compile the stats data.
    1. C:inetpubwwwrootawstats>C:Perbinperl.exe awstats.pl –config=domain.comCompile Perl
      1. C:inetpubwwwrootawstats>C:Perbinperl.exe awstats.pl –config=domain.com
      2. Perl was installed in the C:Perl directory
      3. The config file is named “awstats.domain.com.conf”

Access AWStats through your web browser. The URL is publically available for everyone to view unless you configure security via IIS. To test the configuration, just browse to:

http://localhost/awstats/awstats.pl?config=domain.com

AWStats

One Response to “Tracking Website Activity on IIS”

  1. blog

    I’m impressed, I must say. Rarely do I encounter a blog that’s
    both equally educative and interesting, and without a doubt, you’ve hit the
    nail on the head. The issue is an issue that too few men and women are
    speaking intelligently about. Now i’m very
    happy that I found this in my search for something concerning this.

    Reply

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.