Question

I'm using logparser to retrieve data from my IIS logs.

#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2014-02-12 22:51:18 127.0.0.1 GET /auto.aspx p=es&w=tank&i=87 36910 - 127.0.0.1 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/32.0.1700.107+Safari/537.36 - 200 0 0 143

I have this query:

SELECT * FROM 'C:\\IISExpress\\Logs\\*.log' WHERE c-ip = '127.0.0.1' AND cs-uri-stem LIKE '%auto.aspx%' AND date = '2014-02-12'

How do I filter by time without the seconds? I want something like this:

SELECT * FROM 'C:\\IISExpress\\Logs\\*.log' WHERE c-ip = '127.0.0.1' AND cs-uri-stem LIKE '%auto.aspx%' AND date = '2014-02-12' AND IGNORE_SECONDS(time) = '22:51'
Was it helpful?

Solution

Use the QUANTIZE function to truncate seconds to zero:

WHERE QUANTIZE(TO_TIMESTAMP(date, time), 60) = TIMESTAMP('2014-02-12 22:51:00')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top