设为首页 收藏本站
查看: 959|回复: 0

[经验分享] IIS 网站日志时间延迟及解决方法

[复制链接]

尚未签到

发表于 2018-12-9 13:14:57 | 显示全部楼层 |阅读模式
  刚上线的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 - MS Internet 标准日志文件格式
  n - NCSA 公用日志文件格式
  e - W3C 扩展日志文件格式
  -t  默认值是 ncsa
  -o  默认值 = 当前目录
  -x 将非 www 数据项保存到 .dmp 日志文件
  -d = 将 IP 地址转换成 DNS
  -l = 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


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-649482-1-1.html 上篇帖子: 实现深信服上网行为的单点登录(域中IIS集成验证) 下篇帖子: win2003服务器iis6.0环境下php5.3.2安装配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表