1

I've searched for several examples to analyze IIS logs using the Log Parser, taking time into account... For example, this query that shows the number of hits per hour:

SELECT 
QUANTIZE(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 3600) AS Hour, 
COUNT(*) AS Hits 
FROM D:\Logs\*.log 
Group By Hour

However I cannot understand why use "TO_LOCALTIME"... Also, if there is a time difference (and a difference in results while using "TO_LOCALTIME" or not), how is that?... Thank you!

mahiro
  • 65
  • 2
  • 6

1 Answers1

1

All IIS uses UTC for all times in its logs regardless of the time zone of the server, so to get your local time, you can use TO_LOCALTIME.

I guess if you are fine with UTC, you don't need to use TO_LOCALTIME.

Peter Hahndorf
  • 10,767
  • 4
  • 42
  • 58
  • Thank you! With To_Localtime I'm getting the correct times, however I wasn't understanding why I was getting different times without it... So it's because IIS always uses UTC. – mahiro Oct 24 '13 at 22:00