Home > @opengovsg/logging > SystemLoggerOptions > traceId
SystemLoggerOptions.traceId property
Distributed-trace correlation ID, bound as trace_id. **Usually leave this unset**: with dd-trace running, log injection (DD_LOGS_INJECTION, on by default) already stamps dd.trace_id on every line from the active span - per line, so it also works in jobs, queues, and cron, and Datadog correlates on it natively. Set this only for a non-APM sink that needs a trace id under this schema's own trace_id key; for a gateway-minted ID chained across systems, use SystemLoggerOptions.correlationId instead. Accepts null (e.g. from headers.get); a null value is omitted from the line.
Signature:
typescript
traceId?: string | null;