Connect with us

Hi, what are you looking for?

IIS

Using the DATAGRID output option in Microsoft LogParser to see error 500 IIS issues

I love Logparser but sometimes I don’t want large amounts of data in a command prompt. And you may not want to drop it into a csv file either, you just want a nice readable output in front of your face immediately. So I like to use the DATAGRID output option which gives me a nice neat GUI output for these situations. Here is an example I used this morning to pull all the IIS error 500 messages in an IIS W3C formated log file:

logparser "SELECT date, time, cs-method, s-ip, s-port, cs-username, c-ip, cs-host, time-taken, cs-uri-stem, cs-uri-query FROM C:\Logs\ex100917.log WHERE sc-status = 500" -rtp:-1 -i:iisw3c -o:datagrid

and here’s one to see the average time taken on every page on your site. This is great to pinpoint those pages with high load times that you can possible optimize. In this example, I want to include every page in my stats except those that threw an error 500:

Advertisement. Scroll to continue reading.

logparser -i:IISW3C "SELECT cs-uri-stem, AVG(time-taken) As AvgTimeTaken FROM C:\Logs\ex100917.log WHERE sc-status <> 500 GROUP BY cs-uri-stem ORDER BY AvgTimeTaken DESC" -q:ON -o:datagrid

Now we know how pages normally perform. Now let’s compare that to the pages that did have error 500s. I also want to add a column for the total number of error 500s on each page. So a slight modification in the query:

logparser -i:IISW3C "SELECT cs-uri-stem, Count(*) AS Error500Hits, AVG(time-taken) As AvgTimeTaken FROM C:\Logs\ex100917.log WHERE sc-status = 500 GROUP BY cs-uri-stem ORDER BY AvgTimeTaken DESC" -q:ON -o:datagrid

Advertisement. Scroll to continue reading.

All the data that is output using datagrid exports to an Excel spreadsheet nicely. Just right click, Select All and then copy and paste into your .xlsx spreadsheet.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Apache

Today I would like to go over proper URL redirection when using SSL but first I would like to preface this by describing what...

Exchange 2003

A useful Exchange 2003 guide I wrote for a friend’s blog originally but I am posting it here on mine now for your viewing...

Citrix Workspace

You can use FIDO2 hardware security keys plugged into your physical desktop over the Citrix HDX remoting protocol for use with virtualized Windows Desktop...

Cloud Design Architecture

The community-driven paperback book initiated by my friends Bas van Kaam and Christiaan Brinkhoff is available for sale on Amazon. If you haven’t picked...

Advertisement

JasonSamuel.com was launched in 2008 as a platform to give back to the IT community by sharing knowledge and expertise. Over the years, it has become a trusted global resource for the latest insights, how-to guides, and forward-thinking leadership on enterprise mobility, security, virtualization, cloud architecture, automation, and other cutting-edge technologies. Today, it serves as a go-to reference hub for IT professionals, attracting hundreds of thousands of unique visitors from around the world each month. Learn more on the About Me page.
Copyright © 2008-2025 JasonSamuel.com