Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The $local_time 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, $local_time variable is much more colse to the end of the request than it's start.

share|improve this answer
    
thanks.. can you show me where I could have found this in the documentation? –  Philip Potter Oct 16 '12 at 11:34
1  
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 '12 at 13:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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