IIS Log日志的时间是GMT的

排查问题的时候会发现IIS日志的时间跟服务器本地的时间有不同.

IIS Log的时区设置时GMT的. 注意, 中国的时区是GMT+8。

所以看中国的IIS日志, 要想知道服务器本地的时间, 需要在IIS的日志中+8。

使用Log Parser时, 可以使用下面的例子来对返回结果的时间进行转换.

LogParser "SELECT TO_TIMESTAMP(date, time) AS utc-timestamp, TO_LOCALTIME(utc-timestamp) AS local-timestamp, c-ip, cs-username, EXTRACT_TOKEN(cs-uri-stem,-1,'/') AS filename INTO DATAGRID FROM \\WEBSERVER\admin$\system32\logfiles\w3svc1\ex07*.log"

参考资料:

IIS Log File Entries Have the Incorrect Date and Time Stamp

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q271196

Thread: Converting IIS Log Time to Local Time

http://forums.iis.net/t/1145241.aspx