diff --git a/src/v3/configuration/cli.md b/src/v3/configuration/cli.md index 4642d32..a5fdd88 100644 --- a/src/v3/configuration/cli.md +++ b/src/v3/configuration/cli.md @@ -108,6 +108,8 @@ Options: Log the X-Forwarded-For header for remote IP information [env: SERVER_LOG_FORWARDED_FOR=] [default: false] [possible values: true, false] --trusted-proxies List of IPs to use X-Forwarded-For from. The default is to trust all [env: SERVER_TRUSTED_PROXIES=] + --log-trace-context [] + Add the `trace_id`, `span_id` and `trace_flags` fields of a valid W3C `traceparent` request header to the log lines emitted by the request handler. Requires `--log-format json` [env: SERVER_LOG_TRACE_CONTEXT=] [default: false] [possible values: true, false] --redirect-trailing-slash [] Check for a trailing slash in the requested directory URI and redirect permanently (308) to the same path with a trailing slash suffix if it is missing [env: SERVER_REDIRECT_TRAILING_SLASH=] [default: true] [possible values: true, false] --include-hidden [] diff --git a/src/v3/configuration/env.md b/src/v3/configuration/env.md index 1a85782..21d717a 100644 --- a/src/v3/configuration/env.md +++ b/src/v3/configuration/env.md @@ -187,6 +187,10 @@ Log the `X-Forwarded-For` header for remote IP information. Default `false`. List of IPs to use `X-Forwarded-For` from. The default is to trust all. Default `""`. +## SERVER_LOG_TRACE_CONTEXT + +Add the trace context of a valid W3C `traceparent` request header to the JSON log lines of the request handler. See [Logging Trace Context](../features/logging#logging-trace-context). Default `false`. + ## SERVER_REDIRECT_TRAILING_SLASH Check for a trailing slash in the requested directory URI and redirect permanently (308) to the same path with a trailing slash suffix if it is missing. Default `true` (enabled). diff --git a/src/v3/configuration/file.md b/src/v3/configuration/file.md index 38ab096..913347c 100644 --- a/src/v3/configuration/file.md +++ b/src/v3/configuration/file.md @@ -89,6 +89,9 @@ log-forwarded-for = false #### IPs to accept the X-Forwarded-For header from. Empty means all trusted-proxies = [] +#### Log the W3C trace context of the `traceparent` header (JSON log format only) +log-trace-context = false + #### Redirect to trailing slash in the requested directory uri redirect-trailing-slash = true diff --git a/src/v3/features/logging.md b/src/v3/features/logging.md index 781ebee..aeefd15 100644 --- a/src/v3/features/logging.md +++ b/src/v3/features/logging.md @@ -103,7 +103,7 @@ When the level is `info` or lower, SWS logs each request with the `incoming requ } ``` -The `remote_addr`, `x_real_ip` and `real_remote_ip` fields are added when the corresponding logging options are enabled and a value is available. Fields without a value are omitted. +The `remote_addr`, `x_real_ip` and `real_remote_ip` fields are added when the corresponding logging options are enabled and a value is available, and the `trace_id`, `span_id` and `trace_flags` fields when [trace context logging](#logging-trace-context) is enabled. Fields without a value are omitted. ## Log Remote Addresses @@ -230,6 +230,36 @@ curl "http://[::1]:8080" --header "X-Forwarded-For: