Skip to main content
Logixlysia can automatically generate or retrieve unique request identifiers (Request IDs) and attach them to the request context, response headers, and log outputs.

Basic Usage

You can enable the request ID feature using the requestId config option. When set to true, it uses the default configuration (X-Request-Id header and UUID v4 generator).

Production Preset

The prod preset enables requestId automatically by default:

Custom Configuration

For advanced use cases, you can pass a configuration object instead of a boolean:

Options

Log Formatting

When Request ID is enabled, you can output it in your custom log format using the {requestId} token:
If Request ID is disabled or not present, the token will render as an empty string.

Error Responses

If a request fails (e.g. throws an exception), the request ID is still propagated in the response headers (like X-Request-Id) and is correctly logged in the HTTP error telemetry context, allowing trace correlation for failed requests.