Controlling Request Logging
Using HTTP Headers
Include theX-TFY-LOGGING-CONFIG header on a request with a stringified JSON value. Set enabled to true to log the request or false to skip logging:
Using Global Settings
You can also control logging behavior globally using AI Gateway global settings:In the AI Gateway UI, click
Settings in the left sidebar to open global settings.Migrating to logging configs
Logging Configuration replaces the global logging modes with rule-based control:Payload Size Limit for Traces
TrueFoundry AI Gateway caps the size of input and output span attributes recorded on gateway requests. When a payload exceeds the cap, it is replaced with a skip marker instead of being stored. You can configure this cap using theTFY_TRACE_MAX_PAYLOAD_SIZE environment variable on the AI Gateway. It defines the maximum number of characters allowed for input/output span attributes on a gateway request before they are replaced with a skip marker.
Increase this value only if you need full payloads in traces for larger requests. Larger values increase storage and may affect trace ingestion and query performance.
Enabling Distributed Tracing
- How it works: propagate trace context with the W3C
traceparentheader; the gateway readstracestateto keep parent-child links when a request leaves the gateway and circles back (e.g. an LLM/tool calling back into the gateway), then generates spans and pushes them to the OpenTelemetry Collector. - Enable: set
ENABLE_DISTRIBUTED_TRACING=trueontfy-llm-gateway(defaults tofalse).
Viewing Request Logs
You can view all logged requests in the TrueFoundry UI. Go toAI Gateway > Monitor > Requests

Request logs in the Monitor section