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:
- Goto installation directory of LogParser
- 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.