LLM Request Logs: Metadata Generously, Content Deliberately
Every request log design is two decisions wearing one coat. The first: which metadata to keep. The second: whether to keep the content — the prompt and the completion — at all. Teams that blur them end up with a store that is simultaneously their best debugging tool and a concentrated copy of exactly the data they promised customers they would protect.
The metadata core
A production request log needs five groups:
- Identity — request ID, key, organization. Which call was this, and whose?
- Shape — model, provider, prompt / completion / total tokens. What was asked, and how big was it?
- Outcome — status, latency, cache-hit status. Did it work, how fast, and did we pay for it twice?
- Money — the settled cost of that specific call.
- Time — start and end timestamps.
Cost by model, latency percentiles, error regressions, cache effectiveness, per-key spend: all answerable from those fields alone. This is also where the standards landed — OpenTelemetry's GenAI span convention requires the operation and provider names, recommends the model, finish reasons, response ID and usage token pair, and flags message content as opt-in because it is likely to contain sensitive information.
The join key you must capture yourself
Gateway logs only help if your application can point at a row. Every response carries the request ID in a header (x-nr-request-id), plus the model that actually served the request — not always the one you asked for — and the token counts. Capture the ID at your client wrapper on both the success and exception paths and store it beside your own trace ID. Skip this step and every incident starts with timestamp archaeology.
Two traps ride along with the headers:
- Absent is not zero. The cost header (
x-nr-request-cost) is omitted when a call cannot be priced, and a companion header (x-nr-cost-status) saysunpriced. Defaulting a missing value to zero silently under-reports spend in your dashboards while the ledger — the authoritative store budgets read — stays correct. Treat absent as unknown and reconcile. - Latency is not a header. Time the call on your own clock and store the elapsed value beside the request ID, or read percentiles off the dashboard.
Content: the deliberate exception
On nRouter, request and response content is never written to the log — that is the privacy-safe default, stated plainly. Metadata is always stored because it is the billing record; there is no setting that turns it off and no zero-logging mode. The Data Policy setting (owner or admin only; members see it read-only) changes what the dashboard displays, not what is stored, and it never affects billing. Full-content logging sits on the roadmap, which means the honest runbook instruction today is: if an investigation genuinely needs the exact prompt weeks later, capture it on your own side, deliberately, with your own redaction — do not expect the gateway to have kept it.
Retention follows the same discipline: bounded windows rather than indefinite storage, CSV export for anything that must outlive the window, and financial records kept separately as ledger entries. Keep aggregates long, raw rows short, content shortest of all.
The workflow the log exists for
Capture the ID. Search it on the Logs page. Open the row and check whether a guardrail was involved — guardrail evaluations are logged against the same request ID, and a blocked request never reached the provider. Export the filtered view if you need to hand it over; a filtered export is a smaller liability than a table dump. And keep the categories straight: administrative actions — who changed a budget, who rotated a key — live in the audit trail, a separate, lower-volume store.
One more boundary worth knowing before you design around it: the gateway does not forward logs to external tools today. The working paths are the CSV export, or sending the response headers onward from your own application — with redaction applied before the copy, never after.
The full guide, with the field table, the gateway-versus-self-hosted comparison and a five-step verification routine: https://nrouter.ai/blog/guides/llm-observability-request-logs
About the author
- nRouter is a managed LLM gateway: one OpenAI-compatible API key, with smart routing, automatic failover, guardrails, virtual keys, and per-key budgets enforced in the request path.
Comments
Join the discussionNo comments yet. Be the first to comment.