Using LogParser 2.2 to Parse IIS Logs and Other Logs
page 5 of 13
by Sudeep G
Feedback
Average Rating: 
Views (Total / Last 10 Days): 89193/ 141

Scenario 3: More filtering

Suppose you want to trace requests from a specific username (assuming that the request is not anonymous).

Listing 14

LogParser "SELECT * FROM ex080620.log WHERE cs-username='Domain\User'" -i:IISW3C 
-q:ON –o:Datagrid

Listing 15: Finding requests between specific time frames

NOTE: IIS Logs time in GMT

LogParser -i:IISW3C "SELECT date, time, cs-uri-stem, cs-uri-query, cs-username, 
c-ip, sc-status, sc-substatus, sc-win32-status, time-taken FROM ex080620.log WHERE 
TO_TIME(time) BETWEEN TIMESTAMP('00:00:02','hh:mm:ss') AND 
TIMESTAMP('00:00:08','hh:mm:ss')" -o:DataGrid

Scripting the above

Create a text file and name it as "RequestsInTime.bat" and paste the following line in it. Then save it.

Listing 16

LogParser -i:IISW3C "SELECT date, time, cs-uri-stem, cs-uri-query, cs-username, 
c-ip, sc-status, sc-substatus, sc-win32-status, time-taken FROM %1 WHERE 
TO_TIME(time) BETWEEN TIMESTAMP('%2','hh:mm:ss') AND TIMESTAMP('%3','hh:mm:ss')" 
-o:DataGrid

Run it as RequestsInTime C:\Logs\ex080620.log 00:00:02 00:00:10.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





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


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 7:59:03 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search