我一直在有一些性能问题的服务器上研究 IIS 7.5 中的 W3C 格式日志文件一段时间,在我看来,这与 MSDN documentation 相反。 ,“时间”字段为 不是
"the time, in Coordinated Universal Time (UTC), at which the request occurred"
... 而是响应完成发送的时间。
我之所以这么说是因为当我在一个有点受控的环境中跟踪用户的页面请求顺序时,他们将不得不及时返回提交下一个请求,否则他们能够以惊人的速度提交他们对页面的请求带有大量耗时条目的页面。
例如(为了安全和清晰,我正在编辑、缩写和省略):
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip sc-status sc-substatus sc-win32-status time-taken
2012-11-28 22:25:17 192.168.0.21 GET /Main.aspx - 80 AWalker 192.168.0.100 200 0 0 764
2012-11-28 22:25:26 192.168.0.21 POST /Main.aspx - 80 AWalker 192.168.0.100 200 0 0 109
2012-11-28 22:25:56 192.168.0.21 GET /_Start.aspx - 80 AWalker 192.168.0.100 302 0 0 28782
2012-11-28 22:26:33 192.168.0.21 GET /Action.aspx - 80 AWalker 192.168.0.100 200 0 0 38032
2012-11-28 22:26:46 192.168.0.21 POST /Action.aspx - 80 AWalker 192.168.0.100 200 0 0 124
2012-11-28 22:27:39 192.168.0.21 GET /Information.aspx - 80 AWalker 192.168.0.100 200 0 0 52509
2012-11-28 22:27:52 192.168.0.21 POST /Information.aspx - 80 AWalker 192.168.0.100 200 0 0 140
如果我将“时间”解释为“收到的请求”(开始或结束,但在响应开始之前),那么这看起来是错误的。这就是我的意思:
这种模式在日志中一遍又一遍地发生。
相反,如果我将“时间”字段解释为“响应完成”,那么我会得到更合理的数字:
“时间”字段代表响应的结束而不是请求的开始对我来说更有意义的另一个原因是:
日志条目按“时间”字段的升序(按时间顺序排列)物理记录,但它们始终包含“所用时间”字段,只有在最终交付响应后才能知道。
那么是哪种方式呢?文档有错吗?
最佳答案
本页:http://blogs.msdn.com/b/mike/archive/2008/11/13/time-vs-time-taken-fields-in-iis-logging.aspx
它说:
The Time field is quite straightforward: it specifies when the log entry was created. Note that this is not always the same as when the log entry actually gets written to the log, as buffering can occur for some request/response scenarios.
因此,您认为时间最接近请求完成的时间是正确的。同一页继续澄清:
If you wanted to calculate the approximate Start Time of a request, you would subtract the Time-Taken value from the Time value.
关于iis - 日志中的 "time"字段究竟表示什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13695234/