I'm reading some nginx logs for some rather long-lasting requests (up to 10 seconds). In the log format, we're using the $time_local variable to record the time. But does this mean the time when the request started or when it finished? For a long-running request, these are quite distinct times, and I can't find anything in the ngx_http_log_module documentation to explain this.

1 Answer 1


The $time_local variable contains the time when the log entry is written.

when the HTTP request header is read, nginx does a lookup of the associated virtual server configuration. If the virtual server is found, the request goes through six phases:

  • server rewrite phase
  • location phase
  • location rewrite phase (which can bring the request back to the previous phase)
  • access control phase
  • try_files phase
  • log phase

Since the log phase is the last one, $time_local variable is much more colse to the end of the request than it's start.

  • thanks.. can you show me where I could have found this in the documentation? Oct 16, 2012 at 11:34
  • 2
    nginx.com/docs.html The information is on the link "The Architecture of Open Source Applications Volume II" which is a good reference book.
    – m0ntassar
    Oct 16, 2012 at 13:31
  • Looks like they've changed the URL. It's now at nginx.org/en/docs with the reference book at aosabook.org/en/nginx.html.
    – trss
    Apr 7, 2018 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.