Using LogParser 2.2 to Parse IIS Logs and Other Logs
page 8 of 13
by Sudeep G
Average Rating: 
Views (Total / Last 10 Days): 87915/ 111

Scenario 6: Usage with HTTPErr logs

Get all entries from all HTTPErr logs on the computer.

Listing 21

Logparser -i:HTTPErr "Select * from C:\windows\system32\Logfiles\httperr\*.log" 

Suppose you are investigating a connection failure and you want to check if the connection was dropped from IIS or HTTP; you also want to find out the date, time, the URL requested and the reason for the failure. If this is the case, you can use the following log parser query that will not only give you the log file where the entry is, but also the data you need to further troubleshoot the problem.

Listing 22

LogParser -i:HTTPErr "Select logfilename, date, time, cs-uri, s-reason from 
C:\windows\system32\Logfiles\httperr\*.log" -q:ON -o:datagrid
LogParser -i:HTTPErr "SELECT date, time, c-ip, cs-uri, sc-status, s-reason FROM 
httperr1.log ORDER BY date,time" -o:DataGrid -q:ON

Listing 23: Sorting the output by reason for failure

LogParser -i:HTTPErr "SELECT date, time, c-ip, cs-uri, sc-status, s-reason FROM 
httperr1.log ORDER BY s-reason" -o:DataGrid -q:ON

Now suppose, you are investigating a specific problem, such as "Service Unavailable," and you want to find out details like the client IP, client port, and reason. You can filter this with the sc-status code of 503.

Listing 24

Logparser -i:HTTPErr "Select logfilename, date, time, cs-uri, c-port, s-reason 
from C:\windows\system32\Logfiles\httperr\*.log WHERE sc-status=503" -q:ON 

View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-07-23 12:49:11 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search