AWstats is an open source log analyzer. I built up one on a Windows 2003 server to analyze the intranet (IIS server) usage. Here is my step by step how to:
The software version I use in my example:
1) Install Apache, this is where I want to publish my log analysis. You also can use IIS.
2) Install ActivePerl.
3) Install AWstats, during the installation, you need to answer a few questions. (You can rerun the configuration by executing “C:\Program Files\AWStats\tools\awstats_configure.pl”. In my example, here are my answers:
– Apache folder: C:\Program Files\Apache Software Foundation\Apache2.2
– Apache configure file: C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
– Site name: intranet
4) Verify the following can be found in your httpd.conf file, AWstats installation should have modified it already:
CustomLog “logs/access.log” combined
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses “C:/Program Files/AWStats/wwwroot/classes/”
Alias /awstatscss “C:/Program Files/AWStats/wwwroot/css/”
Alias /awstatsicons “C:/Program Files/AWStats/wwwroot/icon/”
ScriptAlias /awstats/ “C:/Program Files/AWStats/wwwroot/cgi-bin/”
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory “C:/Program Files/AWStats/wwwroot”>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#
5) Add “ScriptInterpreterSource registry” into httpd.conf to tell Apache to use Windows environment path.
6) Create the following folders:
# This is log location
C:\Program Files\AWStats\wwwroot\cgi-bin\logs\intranet# This is the analysis data location
C:\Program Files\AWStats\wwwroot\cgi-bin\data\intranet
7) Edit the awstat config file C:\Program Files\AWStats\wwwroot\cgi-bin\awstats.intranet.conf:
#ex120403.log can be replaced by any string, as long as it keeps consistent in the PowerShell script I will mention in step 10).
LogFile=”C:/Program Files/AWStats/wwwroot/cgi-bin/logs/intranet/ex120403.log”
LogType=W
#Apache-1, IIS-2
LogFormat=2
SiteDomain=”intranet”
DirData=”./data/intranet”
8) Copy the log files from the IIS server “\\ip_address\c$\WINDOWS\system32\LogFiles\W3SVC1” into “C:\Program Files\AWStats\wwwroot\cgi-bin\logs\intranet”
9) Install PowerShell, if it is not there.
10) Create a PowerShell script file named genlog.ps1
#genlog.ps1
$items = Get-ChildItem -Path “C:\Program Files\AWStats\wwwroot\cgi-bin\logs\intranet”
cd “C:\Program Files\AWStats\wwwroot\cgi-bin”
$a=”ex120403.log”
foreach ($item in $items)
{
$old=$a
$new=$item
(Get-Content awstats.intranet.conf) | % {$_ -replace $old, $new} | Set-Content awstats.intranet.conf
echo “Processing this log: $item”
perl awstats.pl -config=intranet -update
$a=$item
}
11) Launch the PowerShell script, and it will start to analyze the logs.
12) Go to “http://Server_IP_Address/awstats/awstats.pl?config=intranet”, and it should look like this: