Logs, Usage & Tracing
Every request through the proxy produces a log row and a usage record. Administrative and security events also produce a tamper-evident audit entry.

Proxy Logs
Logs → Proxy Logs lists one row per request with timestamp, key/user, model, provider, status, TTFT, duration, tokens, and cost. Open a row to inspect request and response bodies, headers, retry/fallback details, and (for smart-routed requests) the routing decision.
| Field | Notes |
|---|---|
status_code | Upstream or proxy status. 499 means the client disconnected mid-request and the upstream call was cancelled |
trace_id | Correlation ID sent to the tracing backend (32-character hex ID). Clicking the trace badge in a row filters the list to all rows in that trace |
ttft_ms | Time to first token (streaming) |
response_time_ms | Total duration |
| Token counts | Prompt, completion, total; cache creation/read; cached prompt; audio in/out |
cost_usd / cache_savings_usd | Billed cost and net cache saving (reads saved minus write premiums) |
fallback_count | Number of provider switches before a provider answered (0 = none) |
log_metadata | Fallback/retry attempts, routing details, provider_model_name |
client_ip, user_agent, auth_method | Client attribution |
| Bodies | JSON, or {"$binary": true, "size": N} for binary payloads. Streaming responses are reassembled into non-streaming JSON unless Log Raw Stream is on |
Reported 0 values are kept distinct from unreported values: 0 means the provider reported zero (such as a fully cached prompt or free request), while unreported values display as - with a "Not reported" tooltip.
You can filter logs by search text, date range, status code or range, model, provider, user, API key, endpoint, log type, had_fallback, and trace_id (via the trace badge or /logs?trace_id=<id>). Non-admins only see their own rows.
Privacy controls
Configured in Settings → Log Management:
- Log Input/Output (default off): master switch for storing request/response bodies. When off, rows still record status, tokens, cost, routing, headers, and diagnostic error reasons (including per-attempt fallback/retry errors), while request/response bodies, upstream error bodies, MCP arguments/results, and web-search queries/results are stored as
{"_bodies_disabled": true}.x-log-full: truecannot override this switch. - Body Sampling Rate (default
1.0): fraction of requests whose bodies are stored when Log Input/Output is on. Sampled-out bodies are stored as{"_sampled_out": true}while metadata is still recorded.x-log-full: trueforces capture for one request. - Log Raw Stream (default off): when off, streaming responses (including native-passthrough streams) are reassembled into non-streaming JSON, which is much smaller, masked, and searchable. Generic image streams keep raw frames. When on (or with
x-log-full: true), raw SSE frames are stored verbatim and are not key-masked (only bounded by Max Logged Body Bytes). - Max Logged Body Bytes (default 1 MiB;
0= unlimited): bodies larger than the cap are stored as{"_truncated": true, "size": N}. Applies even withx-log-full: true. - Mask Sensitive Data (default on): masks credentials in headers, bodies, and MCP/tool arguments (
***for values ≤ 8 chars; first 3 and last 4 chars for longer values). Add custom field names via Extra Sensitive Keys. Admin audit payloads are always masked. - Log Retention Period (default 30 days;
0= forever): deletes expired logs and usage records. The sweep runs at startup and daily, and changing the window sweeps immediately. Manual Cleanup Logs prunes the same two tables by age, and Delete all history wipes them regardless of age. Audit retention and Batch Retention Period (default 30 days) can be configured separately.
Rejected requests
Requests rejected before reaching a provider still appear in Logs:
- Invalid API keys and IP lockouts are recorded in Audit Logs.
- Per-key rate limits (429), budget caps (429/503), and model restrictions (403) are recorded with status, headers, and reason, without request bodies. Repeated rejections for the same key and status within a short window are collapsed into one row with a
suppressed_since_lastcount in metadata.
Usage analytics
The Usage dashboard summarizes total cost, requests, input/output tokens, success rate, average response time, average TTFT, average tokens/second, cache creation/read tokens, and cache savings, with breakdowns by provider, model, and day.
- Usage records share the Log Retention Period window and are preserved when you run manual Cleanup Logs.
- Completed batch jobs and routing-judge calls are included in spend, budgets, and per-key model breakdowns, while request counts and success rate count only direct client requests.
- Latency and throughput metrics are averages. Cache savings require
cached_read_cost_per_1mon the model and report net savings (read savings minus write premiums), which can be negative on write-heavy turns.
Audit Logs
Administrative and security events (logins, member and key management, provider key reveals, and admin configuration changes) are written to a hash-chained audit log so tampering or deletions are detectable.
Click Verify Integrity in Logs → Audit Logs (admin only) to recompute the chain and check for any errors. Audit rows are admin-only.
MCP Calls, Web Search and Judge Calls tabs
| Tab | Contents |
|---|---|
| MCP Calls | One row per MCP operation: server, operation, resource type/name, masked arguments/result summary, status, duration |
| Web Search | One row per intercepted search: query, provider, status, result count, max uses vs. current use |
| Judge Calls | One row per routing-judge call: judge model, provider, resolved upstream model, tokens, cost, status, duration, and verdict metadata, linked to parent_request_id |
Judge rows are written before the parent request finishes, so they are still accounted for if the parent fails. They do not store request bodies.
Tracing
Tracing is per user (Account → Preferences → Tracing). Each user configures their own backends, which only receive that user's requests. Three backends are built in:
| Provider | Sends traces to | Transport | Credentials |
|---|---|---|---|
langfuse | Langfuse cloud or self-hosted instance | Langfuse SDK | public + secret key |
otel | Any OTLP collector (Tempo, Jaeger, Phoenix, Grafana, etc.) | OTLP/HTTP or gRPC | optional Authorization header / gRPC metadata |
langsmith | LangSmith's OTLP gateway | OTLP/HTTP | API key, optional project and workspace ID |
Each backend has a sample rate (0.0–1.0) and a send content policy:
full(default): exports prompt and completion content.inherit: follows Log Input/Output and Mask Sensitive Data (no content when bodies are off; masked content when masking is on).none: never exports prompt or completion content (usage, cost, model, timing, and metadata are still exported).
Secrets are masked after saving; re-saving the form keeps stored secrets. Non-admin users cannot point a collector at private addresses unless the host is in HTTP_ALLOWED_HOSTS (see Security).
What is exported
- Chat (OpenAI, Anthropic, Responses): messages/tools as input, assistant message and tool calls as output, plus a tool observation per tool call.
- Embeddings: input texts and response summary (
count,dimensions,model, and a preview of the first vectors). - Rerank: query and documents (up to 20 documents, 2000 chars each) and ranked results.
- Images & Audio: prompts/parameters or file metadata as input; result URLs, media type/size, or transcripts as output. Binary payloads are never exported.
- System One / Decisions: evaluation state/input and questions as input; answers as output.
- Usage & metadata: token breakdowns (including cache, audio, and reasoning), cost, latency, TTFT, provider, endpoint, and fallback/retry counts.
- OTLP & LangSmith: exports OpenTelemetry GenAI attributes (
gen_ai.*), OpenInferenceinput.value/output.value, andllm_proxy.*attributes. LangSmith uses HTTP only and exports each request as its own root run.
To correlate a trace with a request, send x-langfuse-trace-id or x-trace-id (32 hex chars). The proxy echoes the trace ID on responses and stores it on the log row as trace_id.
When a backend rejects a batch
Rejected trace batches are summarized in the proxy log at most once every five minutes:
401: invalid credentials. Check the Langfuse public/secret key pair or the OTLPAuthorizationheader.403: credential not valid for this host. Check regionalbase_urlfor Langfuse, or workspace/organization headers (X-Tenant-Idfor LangSmith).404: OTLP/HTTP endpoints must include the full traces path (…/v1/tracesor…/otel/v1/traces).413: batch exceeded the collector's request-size limit.- Connection error or timeout: the collector is unreachable from the proxy.
Related
- Settings: retention, masking, sampling
- Cost Control: turning usage data into budgets