nginx-log-format-timing.conf 1.4 KB

1234567891011121314151617181920212223
  1. # Access-log format carrying request timing and the served hostname.
  2. #
  3. # Added 2026-10-16 because prod's logs could not answer a consumer's latency
  4. # question retrospectively: the built-in `combined` format records no time at
  5. # all, so "was it slow yesterday" had no evidence either way and the question
  6. # was unanswerable rather than merely unanswered.
  7. #
  8. # It is `combined` plus three fields APPENDED, never reshaped, so anything
  9. # already parsing the combined prefix keeps working byte-for-byte:
  10. # host= which hostname served it - prod has two serving different surfaces
  11. # (the customer-facing name at the root, and the original /rag mount),
  12. # and without this a line cannot be attributed to either
  13. # rt= $request_time, the whole request as nginx saw it, including the time
  14. # the client spent sending and receiving
  15. # urt= $upstream_response_time, what vectorapi took. The GAP between rt and
  16. # urt is the part a consumer cannot see from their side and is usually
  17. # the answer: a slow client or a large body, not a slow backend.
  18. #
  19. # urt is "-" when nothing was proxied (a redirect, a branded error page), which
  20. # is correct rather than zero - no upstream was asked.
  21. log_format timing '$remote_addr - $remote_user [$time_local] "$request" '
  22. '$status $body_bytes_sent "$http_referer" "$http_user_agent" '
  23. 'host=$host rt=$request_time urt=$upstream_response_time';