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.