Skip to content

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.

Request logs

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.

FieldNotes
status_codeUpstream or proxy status. 499 means the client disconnected mid-request and the upstream call was cancelled
trace_idCorrelation 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_msTime to first token (streaming)
response_time_msTotal duration
Token countsPrompt, completion, total; cache creation/read; cached prompt; audio in/out
cost_usd / cache_savings_usdBilled cost and net cache saving (reads saved minus write premiums)
fallback_countNumber of provider switches before a provider answered (0 = none)
log_metadataFallback/retry attempts, routing details, provider_model_name
client_ip, user_agent, auth_methodClient attribution
BodiesJSON, 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: true cannot 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: true forces 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 with x-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_last count 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_1m on 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 ​

TabContents
MCP CallsOne row per MCP operation: server, operation, resource type/name, masked arguments/result summary, status, duration
Web SearchOne row per intercepted search: query, provider, status, result count, max uses vs. current use
Judge CallsOne 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:

ProviderSends traces toTransportCredentials
langfuseLangfuse cloud or self-hosted instanceLangfuse SDKpublic + secret key
otelAny OTLP collector (Tempo, Jaeger, Phoenix, Grafana, etc.)OTLP/HTTP or gRPCoptional Authorization header / gRPC metadata
langsmithLangSmith's OTLP gatewayOTLP/HTTPAPI 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.*), OpenInference input.value/output.value, and llm_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 OTLP Authorization header.
  • 403: credential not valid for this host. Check regional base_url for Langfuse, or workspace/organization headers (X-Tenant-Id for LangSmith).
  • 404: OTLP/HTTP endpoints must include the full traces path (…/v1/traces or …/otel/v1/traces).
  • 413: batch exceeded the collector's request-size limit.
  • Connection error or timeout: the collector is unreachable from the proxy.

MIT licensed