Quickstart with AWStats and IIS 7
AWStats is a free, Perl-based analyzer for log files. To get results quickly on a Windows Server 2008 with IIS 7 you only have to follow a few steps. These are not well documented in the AWStats documentation and require some time of research. This post will show you how to set up AWStats with IIS7 in only a few minutes.
- Install Perl, e.g. ActivePerl. There are 32-bit and 64-bit versions available. Make sure that Perl is added to your PATH environmental variable. The ActivePerl installer usually provides this option during the installation.
- Install AWStats. Remember the path AWStats is installed. Paths used below are based on the installation folder of AWStats. In this example we use c:awstats.
- Run the configuration script at c:\awstatstoolsawstats_configration.pl. Follow the on screen instructions. This will create a default configuration file in c:\awstatswwwrootcgi-bin e.g. called awstats.www.example.org.config. The site name www.example.org depends on whatever site name was provided while running the script. When asked for the Apache Web server path type in none.
- Open the configuration file awstats.www.example.org.config with any text editor of your choice.
- AWStats already supports IIS, however, it is required to tweak the config file. First change the entry for LogFile. Log files for IIS might be found at c:inetpublogsLogFilesW3SVCNNN where NNN is a different number for each web site, IIS creates log files for. Change the entry toLogFile=”c:awstatstoolslogresolvemerge.pl c:inetpublogsLogFilesW3SVC1*.log |”
This will merge all log files for a site provided by IIS. Adjust the paths corresponding to your installations and desired log file folders.
- The AWStats configuration file offers the possibility to set the LogFormat to IIS (LogFormat=2), however, the log entries provided by a standard installation of IIS 7 won’t match. The AWStats documentation recommends to change the settings of IIS. The change will take effect only after restarting the Web site and is only valid for entries after that particular moment. Consequently, this is not an option if you are going to analyze the logs of the last 12 months where the original settings were used. To make AWStats work with the standard log format of IIS 7 change the LogFormattoLogFormat=”%time2 %other %method %url %other %query %other %host %other %code % %other %other %bytesd”
- Change SiteDomain and HostAliases to meet the settings of your site.
- Change to c:awstatswwwrootcgi-binand runawstats.pl -config=www.example.org
This will build the statistics database for AWStats.
- To create output runawstats.pl -config=www.example.org –output –staticlinks > …example_org_stats.html
- Not that example_org_stats.html is created one folder up. In case you do miss this, the output will not work correctly until you adapt the entries for DirCgi and DirIcons in the configuration file.
- The output file is now located in c:awstatswwwroot. You might want to create a Virtual Directory or set up a Web site to view the reports via the Web or your Intranet.
Repeat steps 3-7 fore each site you want to create reports for. Repeat step 8 and 9 every time you want to create a new report.