Log parser 2.2:How can you use Log Parser for analyzing IIS Log files.

by Rahul 7/16/2008 10:17:49 AM

I have written an article on Log parser a while ago at Log Parser 2.2 and ASP.NET. Please read it before you continue on this post...

Here are some of the other scenarios in which you could use it...

Scenario 5: Analyzing the IISlogs to see if there is any pattern for errors

A small background of the problem
You are using Microsoft Internet Information Services (IIS) 6, have a few Web sites, and you are using COM components in a lot of your webpages. Now, somehow you find that there are quite a few errors being reported by the users, say error #500 "Internal Server Error". You might like to know if there is any pattern for that, like any specific pages, etc.

Answer: Open the Log Parser command window, and use the following command:

LOGPARSER -i:IISW3C file:C:\LPQ\FindErrorInIISLogFiles.sql -rtp:-1 -q:on

FindErrorInIISLogFiles.sql contains the following code...

SELECT
COUNT(*) as [Count],
cs-uri-stem,
sc-status from
C:\ex060813.log
WHERE sc-status = 500
GROUP BY cs-uri-stem, sc-status
ORDER BY [Count] DESC

Sample output

Count cs-uri-stem              sc-status
----- ------------------------ ---------
28    /ru/Reporting.asp        500
20    /ru/CreateMail.asp       500

As can be seen, now we know the culprit and it is the pages listed above which we need to look at and fix! Here, -i:IISW3C signifies that we are querying the IIS W3C logs. You can view the complete list of IISW3C input format fields in the documentation and frame your query accordingly.

Cheers,
Rahul


Quote of the day:
The remarkable thing about Shakespeare is that he really is very good, in spite of all the people who say he is very good. - Robert Graves


blog comments powered by Disqus

Comments

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0