IIS log parsing and performance tests


We had a stress test at work today and the test manager wanted some statistics on how the IIS performed during the test and what pages that had largest hit rates and so on. In addition, he wanted some overview of the error codes that had occurred during the test period.

We hadn’t much time after the test to create the basics for the report, so we did it after the KISS principle (Keep-It-Simple-Stupid). We decided to retrive a summerized hit rate grouped for each 10 minute, hit count for each page during the test and how many request was made grouped by IP-address.

I had to download and install the IIS LogParser application, as described in my earlier post, and create scripts to archive the result that the test manager wanted. Put the scripts into seperate files and run the command from the command prompt:

  1. Goto installation directory of LogParser
  2. Type command “LogParser.exe -i:W3C file:<script_filename.sql> -o:CSV

The following script will summerize the traffic statistics on the IIS for 17th June 2011.

SELECT 
    QUANTIZE(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 600) AS Min10, 
    COUNT(*) AS Hits 
FROM C:\WINDOWS\system32\LogFiles\W3SVC1\* 
WHERE date >='2011-06-17' and date < '2011-06-18' 
Group By Min10

The following script will list the top 10 URLs with the most hits for 17th June 2011.

SELECT TOP 10  
    cs-uri-stem as Url,  
    COUNT(*) As Hits  
FROM C:\WINDOWS\system32\LogFiles\W3SVC1\*  
WHERE date >='2011-06-17' and date < '2011-06-18' 
GROUP BY cs-uri-stem  
ORDER By Hits DESC

The following script will list the IP and number of requests sent to the IIS for 17th June 2011.

SELECT c-ip As Machine,  
        COUNT(*) As Hits  
FROM C:\WINDOWS\system32\LogFiles\W3SVC1\* 
WHERE date >='2011-06-17' and date < '2011-06-18' 
GROUP BY Machine 
ORDER BY Hits DESC

Happy IIS debugging and performance testing.

Advertisements

2 thoughts on “IIS log parsing and performance tests

  1. Roar, why do you use a daterange, when you want exactly one date? Why not use

    WHERE date = ‘2011-06-17’

    johrun

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