LogParser: Filter records for specific time frame/date

Today using Logparser for parsing the ETL file.I did spend some time on filtering it right way to see the activity for specific time frame. Thought to share with you.

In ETW file we’ve TimeStamp column that contains value like "2009-07-31 13:34:42"

Now if you would like to filter all the records that should fall between 13:30 and 13:35 , you would have do it like this

logparser "select * from iis6.etl where to_time(timestamp) between timestamp('13:33:00', 'hh:mm:ss') and timestamp('13:35:00', 'hh:mm:ss')" -rtp:-1 -o:datagrid

Output:

clip_image002

TO_TIME() is used to convert a full TIMESTAMP value into a TIME-only "subtype", so that you can use the original timestamp in comparisons with a time value.

TO_DATE is the DATE equivalent of TO_TIME.

For example:

logparser "select * from iis6.etl where TO_DATE(timestamp) = timestamp('07/31', 'MM/dd')" -rtp:-1 -o:datagrid

Till the bye bye…