IIS 网站日志时间延迟及解决方法
2011-04-08 17:17
507 查看
刚上线的IIS观察了下日志文件
结果发现日志文件明显延迟了八个小时。
经过一番查询,在MS官方找到了答案。
IIS Log File Entries Have the Incorrect Date and Time Stamp
SYMPTOMS
The date and the time stamp on entries in the IIS log files appear to be incorrect by several hours when you compare the date and the time stamp to the local time on the server.
CAUSE
The selected log file format is the W3C Extended Log File Format. The extended log file format is defined in the W3C Working Draft WD- logfile-960323 specification by Phillip M. Hallam-Baker and Brian Behlendorf. This document defines the Date and Time files to always be in GMT. This behavior is by design.
Resolution 1
Change the active logging format to the Microsoft IIS Log File Format. This format logs in the server's Local Time.
Resolution 2
Use the Convlog.exe utility, which is located in the Winnt\System32 folder, to convert the log to the NCSA Log File Format and server's local time. At a command prompt, type the following:
convlog -ie LogFileName -t ncsa:+/-GMTOffset
where LogFileName is the name of the file to convert and GMTOffset is the number of hours to correct.
For example, to convert a file named "Logfile.log," and correct for Eastern Standard Time, you would use the following command:
convlog -ie Logfile.log -t ncsa:-0500
You can find complete instructions on how to use the Convlog utility in the IIS online documentation.
链接:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q271196
上面讲的大概意思是,由于IIS默认的日志格式为W3C标准日志文件,而W3C是按照GMT时间进行记录的。中国刚好是GMT+8,所以,记录的时间数值上差了8小时,实际上是实时的。
解决方法1:
使用 Microsoft IIS日志文件格式 进行记录
“打开“Internet 信息服务(IIS)管理器”,点击“Internet信息服务”、“本地计算机”、“网站”,在需要的网站上(如果要设置所有的网站,则直接在“网站”上)右击“属性”,打开网站属性。
在“网站”标签下找到“活动日志格式”,点击其后的“属性”,打开IIS日志属性
在IIS日志属性“常规”标签下,找到“文件命名和创建使用当地时间”,在其前打勾。
点击两次“确定”退出“Internet 信息服务(IIS)管理器”。 ”
解决方法2:
使用日志转换命令convlog
用法: convlog [options] LogFile
选项:
-i<i|n|e> = 输入日志文件类型
i - MS Internet 标准日志文件格式
n - NCSA 公用日志文件格式
e - W3C 扩展日志文件格式
-t <ncsa[:GMTOffset] | none> 默认值是 ncsa
-o <output directory> 默认值 = 当前目录
-x 将非 www 数据项保存到 .dmp 日志文件
-d = 将 IP 地址转换成 DNS
-l<0|1|2> = MS Internet 标准日期格式
0 - 月/日/年(默认值,如美国)
1 - 年/月/日(如中国)
2 - 日.月.年(如德国)
-c = 即使发现格式不正确,也继续执行
如:
convlog -ii in*.log -d -t ncsa:+0800
convlog -in ncsa*.log -d
convlog -ii jra*.log -t none
结果发现日志文件明显延迟了八个小时。
经过一番查询,在MS官方找到了答案。
IIS Log File Entries Have the Incorrect Date and Time Stamp
SYMPTOMS
The date and the time stamp on entries in the IIS log files appear to be incorrect by several hours when you compare the date and the time stamp to the local time on the server.
CAUSE
The selected log file format is the W3C Extended Log File Format. The extended log file format is defined in the W3C Working Draft WD- logfile-960323 specification by Phillip M. Hallam-Baker and Brian Behlendorf. This document defines the Date and Time files to always be in GMT. This behavior is by design.
Resolution 1
Change the active logging format to the Microsoft IIS Log File Format. This format logs in the server's Local Time.
Resolution 2
Use the Convlog.exe utility, which is located in the Winnt\System32 folder, to convert the log to the NCSA Log File Format and server's local time. At a command prompt, type the following:
convlog -ie LogFileName -t ncsa:+/-GMTOffset
where LogFileName is the name of the file to convert and GMTOffset is the number of hours to correct.
For example, to convert a file named "Logfile.log," and correct for Eastern Standard Time, you would use the following command:
convlog -ie Logfile.log -t ncsa:-0500
You can find complete instructions on how to use the Convlog utility in the IIS online documentation.
链接:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q271196
上面讲的大概意思是,由于IIS默认的日志格式为W3C标准日志文件,而W3C是按照GMT时间进行记录的。中国刚好是GMT+8,所以,记录的时间数值上差了8小时,实际上是实时的。
解决方法1:
使用 Microsoft IIS日志文件格式 进行记录
“打开“Internet 信息服务(IIS)管理器”,点击“Internet信息服务”、“本地计算机”、“网站”,在需要的网站上(如果要设置所有的网站,则直接在“网站”上)右击“属性”,打开网站属性。
在“网站”标签下找到“活动日志格式”,点击其后的“属性”,打开IIS日志属性
在IIS日志属性“常规”标签下,找到“文件命名和创建使用当地时间”,在其前打勾。
点击两次“确定”退出“Internet 信息服务(IIS)管理器”。 ”
解决方法2:
使用日志转换命令convlog
用法: convlog [options] LogFile
选项:
-i<i|n|e> = 输入日志文件类型
i - MS Internet 标准日志文件格式
n - NCSA 公用日志文件格式
e - W3C 扩展日志文件格式
-t <ncsa[:GMTOffset] | none> 默认值是 ncsa
-o <output directory> 默认值 = 当前目录
-x 将非 www 数据项保存到 .dmp 日志文件
-d = 将 IP 地址转换成 DNS
-l<0|1|2> = MS Internet 标准日期格式
0 - 月/日/年(默认值,如美国)
1 - 年/月/日(如中国)
2 - 日.月.年(如德国)
-c = 即使发现格式不正确,也继续执行
如:
convlog -ii in*.log -d -t ncsa:+0800
convlog -in ncsa*.log -d
convlog -ii jra*.log -t none
相关文章推荐
- IIS 日志 时间不对的解决方法
- IIS建立网站后显示“403.1禁止访问”的解决方法
- IIS上部署MVC网站,打开后ExtensionlessUrlHandler-Integrated-4.0解决方法IIS上部署MVC网站,打开后500错误
- log4j日志时间与系统时间不一致问题解决方法
- 用vs2005打开本地IIS上网站时报告不是应用程序的解决方法。
- IIS 添加网站显示错误消息 “无更多可用的内存以更新安全信息” 解决方法
- 针对aspx木马可以读取iis站点信息,跨网站目录的临时解决方法
- iis部署asp.net mvc网站出错的解决方法
- 局域网不能访问本机IIS网站的解决方法
- 解决ASP.NET使用IIS架设网站时“服务器应用程序不可用”的方法
- IIS7.5中调试.Net 4.0网站出现无厘头、500错误的解决方法
- IIS访问网站用户过多的解决方法
- IIS网站浏览时提示需要用户名密码登录-解决方法
- IIS网站浏览时提示需要用户名密码登录-解决方法
- IIS发布网站:CS0016: 未能写入输出文件的解决方法
- IIS启动网站出错的几个解决方法
- IIS网站本机可以访问但局域网其他机器无法访问 解决方法
- 调试ASP.NET网站IIS环境问题解决方法汇总
- asp.net 2.0发布的网站本地IIS执行正常但发布到远程服务器上乱码的解决方法
- iis网站发布时在其他电脑上访问的时候报数据库连接的错误的解决方法