Apache2: When is access log written

Hi,

I was wondering if anyone can point me to documentation describing when the Apache 2 access log is written. Is it before or after the request is handled?

The reason I ask is that I use Pingdom to check my website and have been experiencing increasing response times with their service, and then suddenly two days ago it dropped back down to a more reasonable level. I noticed in the access log when they said it two 3 seconds for a response, my log said it was 3 seconds after they said they tried. Does this mean it took 3 seconds for Apache to start working on the request or 3 seconds to complete the request?

Thanks, Josh

4 Replies

I can't immediately point to any detailed information about this at the moment, but based on information that can go into the log file (including the returned HTTP status code and bytes served in the response, as well as the fact that conditional log configurations can include certain files, request types, source IP addresses, etc), I'd say it's logical to assume that information to the log file is written once the request has been served.

Here's a list of possible fields that can be used in a LogFormat configuration statement, though:

http://httpd.apache.org/docs/2.2/mod/mo … ml#formats">http://httpd.apache.org/docs/2.2/mod/modlogconfig.html#formats

Yup, it's after the request is done. You can test this by whipping up a CGI script that sleeps for 10 seconds. I don't know where it's documented, but I haven't seen a web server (or any server, really…) operate differently.

Yes, logged after request, that's why slowloris can't be detected via logs.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct