AWStats on IIS7 (in less steps than the closest cup of coffee. Well almost. )


So, you want AWStats on IIS7?  This doesn’t require a restart of IIS, so it can be done in place with no issues.

For IIS6, you will need to look elsewhere sorry. I’m also sorry you still have to deal with IIS6.

The 2 Required Files

  • ActiveState ActivePerl –
  • AWStats Installer (awstats-7.0.exe
  • Installing ActivePerl



    Accept the agreements, etc.. until you come to the Custom Setup screen


    I have removed the Docs and the Examples.


    I have unticked the create IIS virtual directory as it’s not needed.


    Click Install.
    This is important: When it has finished installing, LOG OUT of (or even better, reboot if you can) the system.
    Logging out and back in will allow the system to pick up the new PATH that was modified by the ActivePerl install.

    Installing AWStats



    Use the default directory, and click Install

    If you get an message stating that no Perl is detected:
    Make sure you installed ActivePerl, and
    Log out and log in again, or
    Restart the machine

    You will be presented with this; a command prompt. This is going to set up your default config file for your domain.


    It will try to detect Apache, but you don’t want that.

    So type "none”


    It is asking you to create a new config file.

    Type “y”


    Enter in your domain name e.g.


    The config still needs to be set up properly, but for now we will create the website and the config after that.


    Creating an IIS7 site

    Create a new site through INetMgr (the standard IIS manager)


    I have un-ticked “start web site immediately”, but this may not be important. You will have to restart this site once it is configured properly.

    Your settings can be different to these, but I have changed the default port to a random port (e.g. 1388) so this site is neither running as the default site, nor visible to the public as our firewall blocks this port.



    For this website (awstats), go to the “Handler Mappings”


    Click “Add Module Mapping”.


    Set it up as I have here:

    Request Path: *.pl
    Module: IsapiModule
    Executable: C:PerlbinPerlEx30.dll
    Name: Perl


    Click Yes. You do want this to be allowed.

    64 bit Machines only:
    Make sure the site’s application pool is set to “Enable 32 Bit Applications”



    Start up the website. You may need to start the application pool as well.


    Moving the AWStats site into place

    Go to your AWStats install folder


    (mine is C:Program Files (x86)AWStatswwwroot )

    Copy these folders and files to your website folder (C:inetpubawstats)

    Go to your site in a browser to see if you are good to go:


    You SHOULD get an error like this:

    Error: Couldn’t open config file "awstats.localhost.conf" nor "awstats.conf". Please read the documentation for directories where the configuration file should be located.

    If you do, be happy. We can move on. If you don’t, leave me a comment and I can try to help you out.

    Getting The Right Information From the Target Site

    You will need to get this information from your site that you wish to analyse:

    1. The location of your log files

    This is typically C:inetpublogsLogFilesW3SVC + the ID of the site. Hint: The ID can be found in the INetMgr where the sites are listed.


    2. The name of your log files

    Is the name u_ex or just ex? Maybe something different altogether.

    e.g. u_ex101110.log

    3. The format of your log files

    In one of the log files that are in that folder, there is a line at the top you will need to copy:

    #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken

    Setting up the Config and Linking to the Logs


    If you go to your website folder and have a look in the cgi-bin (C:inetpubawstatscgi-bin) you will see a file called

    Open this in your favourite text editor. You will need to change a few things:


    will need to be replaced by the location of your log files for IIS7.

    For “u_ex” names:

    LogFile=”[PATH TO YOUR LOG FILES]u_ex%YY-24%MM-24%DD-24.log”

    The funny bit at the end is actually matching the log to the day (or more accurately, the previous day) the report runs. This means your report generation will need to be run at least every day.

    You need to now set the format in which AWStats reads the files

    Look for


    And replace this with (using the example format taken from the log file I used)

    LogFormat= “date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken”

    NOTE: This is not the optimal log file format setup for AWStats.There is guide at sysadmin geek that can help with setting up optimally, with data transfer and referrer logs. To do this you will need to change the IIS log settings to provide different data. The reason I’m leaving that out for now is that I want this to be an easy setup. You can change things after you have got it working!

    Find HostAliases and add in all aliases associated with this site.
    HostAliases=" localhost"

    From a security standpoint, there are some other settings you can play with, but they are not going to be looked at deeply here. Examples  are :


    Running the first report generation

    It comes down to this.

    Start up a command prompt, and run:

    cd C:inetpubawstatscgi-bin
    Perl – –update

    This should start reading the Log files. When it is finished, go to the site in a browser:


    If you see some numbers, congratulations!

    Setting up the Scheduled Task

    Now you have to run this every day, as the system does not automatically update.

    I won’t go into detail here as there are many sites on setting up Scheduled Tasks in the Task Scheduler, but this is the screen shot of my settings:



    Conclusion & Things You May Want To Do

    So that is how to set it up. Any queries and / or suggestions, let me know.

    Do you want better stats with referrers and search engine queries?
    Trying to set up better reporting by changing IIS Log settings. There is a good guide at sysadmin geek with all the settings.


    Do you want to parse old log files from months before?

    There is a way to do this by specifying log files specifically, or by merging log files and then reading that merge specifically. This can be be done by specifying the file name in the config. You can use a tool included with awstats called “” to merge the log files, which can take a while for multi gig log files.

  • Advertisements

    25 thoughts on “AWStats on IIS7 (in less steps than the closest cup of coffee. Well almost. )

    1. Hi there,

      I appreciate your precise and concise steps to setup awStats.

      And, I manage to setup as per your steps until the stage


      If you see some numbers, congratulations!

      I really can see the numbers. But I can see only links from 1388 or something like this.

      I cannot see links from other websites or search engine, I cannot also see hosts that link to my website.

      Could you help?



    2. Hi,

      I tried to install awstats the way you explained and when i do the step of “Running the first report generation”

      As soon as go c:inetpubawstatscgi-bin>perl -config=<> -update
      it gives me an error
      Create/Update database for config “./awstats.<<" by AWStats version 7.0 (build 1.971)
      from datain logfile "/var/log/httpd/mylogs.log"…
      Error: Couldn't open server log file "/var/log/httpd/mylog.log" : No such file or directory
      Setup ('./awstats.<>.com.conf’ file, webserver or permission) may be wrong.
      check config file, permissions and AWStats documentation (in ‘docs’ directory).

      —Please let me know what has to be done for me to get my numbers. Your help is greatly apprecieated.

      Thank you,


    3. This helped a lot. I now have AWStats coming up in my browser for my Intranet using: http://intra/cgi-bin/

      However I’m getting all zeros! I’m sure my path to my LogFiles are correct ie)

      I’ve followed the instructions here carefully. I’ve also set the SiteDomain to the name of our server.

      Anything I might be missing?



      • I haven’t done this for a while, so sorry I am not sure. It was tricky, and it might be easier to do it again and see if it works. Sorry that is not much help probably.


    4. could you please help me to get log format of this:

      2013-03-19 23:59:30 GET “” 200 1337824 4.142 – 720 “Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0.2) Gecko/20100101 Firefox/10.0.2” “” – “” “1337344” Success 480 “” “” “” “”

      2013-03-19 23:59:58 GET “” 200 21003 0.107 – 477 “Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22” “” – “” “20502” Success 501 “” “” “” “”


    5. Are you able to provide a screenshot of what a example log file looks like? This looks like an excellent solution, my concern is if it’s able to show users and IP addresses of who is contacting the server – I use IIS & WebDAV to give people access to files remotely. I imagine I would see the files with GET verbs all over the place. Is this accurate?


    6. For Windows Server 2008 R2, the following changes had to be made in order to get the scheduled task to work properly:
      C:[PERL folder]perl.exe C:[Path to AWstats] -config=mysite -update

      For the scheduled task properties as it relates to my site, it was:
      Actions: Start a program
      Program/script: C:Perl64binperl.exe
      Add arguments (optional): -update

      I ran the task on-demand and everything updated properly.


    7. Very nice instructions, thanks!

      Is there a way to wipe out previously loaded data?
      maybe something like

      perl -clean
      perl -clear


    8. One more thing, the only problem I had with the instructions was this:
      My IIS server is running Windows X64.
      So it made sense to me to try to install the X64 version of Perl, but that didn’t work.
      I had to install the x86 version of Perl.

      thanks again.


    9. Excellent article.. I was able to setup my awstat in less than an hour using your well documented template! I was also able to get 5 year worth log files parsed using the setting –
      LogFile=”/cygdrive/e/awstats-7.2/tools/ /cygdrive/c/Logs/W3C_LogFiles/W3SVC1/*.log |”

      Thank you so much for writing this up!


    10. Hi

      Thanks for the perfect guide, can you please tell us the easy steps to configure the GeoIP city database plugin with awstats?


      Abdul Raheem


      • I’m sorry I think that there is error in the the web.config file

        I’ve correct the problem but now, I’ve the following error:

        The website cannot display the page


        • Hi Sophie
          I think that the problem It’s in the hanlder mappings.

          In this guide, there are two problem:

          1) use the equal symbol—-> Perl – –update
          2)Under the Connections tab on the left click on your computers name. Then double click “Handler Mappings”
          Under the Actions tab on the right click “Add script map”
          Request path: *.pl
          Executable: c:Perlbinperl.exe “%s” %s
          Name: Perl Script (PL)
          Click OK
          Click Yes on the “enable ISAPI message”
          For people running 64bit Windows like me you’ll get an error saying illegal characters. Enter the executable as just “c:Perlbinperl.exe” and we’ll correct this later.
          Click “add script map” again and enter:-
          Request path: *.cgi
          Executable: c:Perlbinperl.exe “%s” %s
          Name: Perl Script (CGI)
          Click OK
          Click Yes on the “enable ISAPI message”

          For me It’s work


    11. When I go to the site in browser, I have the following:
      an unhandled win32 exception occurred in w3wp.exe[some_number]

      Does anyone can help ?


    Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s