大网数据广告活动
网站运营与故障问答

When does Apache log to access.log - before or after serving the request?

· 52CE 我爱测

Reading this post " Understanding Apache Access Log " it refers to http://httpd.apache.org/docs/1.3/logs.html which says %t is the time the server finished processing the request. By this I understand that a line in access.log wi…

问题原文

原帖链接 · rhellem · CC BY-SA 4.0

Reading this post "Understanding Apache Access Log" it refers to http://httpd.apache.org/docs/1.3/logs.html which says

%t is the time the server finished processing the request.

By this I understand that a line in access.log will not be written until the request has been served by the server. So if the request takes one minute, the timestamp will be one minute after the server received the request.

But, the above doc is for Apache 1.3. Reading this one http://httpd.apache.org/docs/2.2/mod/mod_log_config.html it says

%t Time the request was received (standard english format)

Now understanding that based on the above example, the timestamp is referring to when the request was first received by the server. But if so, then Apache would need to update access.log yet another time when the request has been served. Or maybe wait to update access.log until the request has been finished, but I doubt that since I would expect the events not to be sorted by time - but they are (making the first explanation more reasonable according to my understanding.

So which one is correct, finished processing or received - or both depending on version? (Or, what have I not fully understood...)

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 3.0

Apache writes to the log file after the request has been completed. It is able to remember the time that the request was started and write this time into the log file after the request was finished.

This means that Apache log files are not going to be strictly ordered. There may be earlier records that get recorded late because the requests takes a long time.

Apache never goes back and revises log entries.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。