IIS Logfile analyser


Recently, I needed a tool for analysing the web site traffic for a customer. Microsoft IIS isn’t my main working area, so I started googling for free tools available. I came accross utilities from commecial companies like webtrend, but that wasn’t what I was looking for.

I found a great blog post from carlosag that describes a Microsoft utility called Log Parser that has a SQL-like command-line interface. Just something for me 🙂

I create a file traffic_2011_March.sql with the following statement to determine hourly hit calculations for march month.

SELECT 
    QUANTIZE(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 3600) AS Hour, 
    COUNT(*) AS Hits 
FROM c:\inetpub\logs\LogFiles\W3SVC1\* 
WHERE date >='2011-03-01' and date < '2011-04-01' 
Group By Hour

Opened a CMD window and located LogParser directory “C:\Program Files (x86)\Log Parser 2.2”, and ran the command.

LogParser.exe -i:W3C file:traffic_2011_March.sql -o:CSV

Visit Log Parser community forum.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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