Logparser is a powerful utility which comes handy for me whenever I’m helping my customers facing a problem with slow running pages, frequently hit pages, post mortem analysis to find what went wrong on IIS, et al. You can use Logparser to parse your IIS logs to health check the state of your server, and the requests it had served. Below are few LogParser scripts, and their corresponding output in chart format – you can choose your own format, but isn’t a picture worth a 1000 words?

Note : change the GIF file location, and chartType to get more awesome images.

Finding Top 20 hit URLs

> logparser "select top 20 cs-uri-stem, count(*) as Hits into c:\mychart.gif from c:\inetpub\logs\logfiles\w3svc1\*.log group by cs-uri-stem order by Hits DESC" -i:w3c -chartType:barstacked -view:on

image 

Finding Error codes
 

> logparser "select sc-status, count(*) as Hits into mychart.gif from c:\inetpub\logs\logfiles\w3svc1\*.log group by sc-status" -i:w3c -chartType:pieexploded3d -view:on

image

Finding the top 10 client IPs

> logparser "select top 10 c-ip, count(*) as Hits into mychart.gif from c:\inetpub\logs\logfiles\w3svc1\*.log group by c-ip order by Hits DESC" -i:w3c -chartType:bar3d -view:on

image

Slow running pages

> logparser "select top 10 cs-uri-stem, time-taken from c:\inetpub\logs\logfiles\w3svc1\*.log order by time-taken DESC" -i:w3c


cs-uri-stem                                                           time-taken
------------------------------------------                        ----------
/IRTcalculator/default.aspx                                  101262
/TestingWebsite/WebsiteThumbnailImage.aspx 42495
/IRTcalculator/default.aspx                                  33711
/Qod/ScoreCard.aspx                                          28672
/IRTcalculator/default.aspx                                  24802
/IRTcalculator/default.aspx                                  24169
/IRTcalculator/default.aspx                                  22732
/QoD/                                                                   20967
/IRTcalculator/default.aspx                                  20358
/IRTcalculator/default.aspx                                  19281

 

This above query will list you the top 10 URL’s which are taking more time – be informed that this time-taken field in IIS 6/7 will contain the network time to, this is just not only the IIS processing time.

More to come! Hope this helps.