skip to content

As owner of a shared model gateway, how do you set per-route body logging and read access when legal asks who can read logged prompts?

level: principalimportance: should knowfreq 32%

answer

  1. two tiers, not one switch
  2. metadata for all, bodies by route
  3. a central store of everyone's prompts
  4. reads go through an audited path
  5. no bodies, no replay

basics

~20 s

Log metadata on every route and full bodies only on routes whose owners opt in for a stated purpose such as debugging or replay. Store bodies apart, and let only the owning team and named roles read them through an audited path.

solid answer

~40 s

I make metadata the default for every route: team, key, route, resolved model, token counts, latency, status and finish reason, plus a hash of the prompt. Full request and response bodies are logged per route, only when the route's owner opts in with a purpose, such as debugging or a planned model migration, and the route's data class is approved for it. Bodies sit in a separate store with its own permissions, so a cost dashboard never grants prompt access. The owning team reads its own bodies; platform engineers read them only through a time-boxed, logged break-glass grant; every read is audited, and that audit is what I hand legal. The trade-off I state openly: a route without bodies cannot be debugged from the log or replayed later, and its owner is choosing that.

go deeper

for a junior

Recall the two tiers: metadata about every call, and full prompt and response bodies only on the routes that need them.

for a middle

Explain what each tier enables, metadata for cost, latency and errors and bodies for debugging and replay, and why bodies belong in a separate store.

for a senior

Describe the access model: the owning team reads its own bodies, operators use scoped break-glass, every read is audited, and replay jobs stay inside the boundary.

for a principal

Own the default and name its price: bodies on by default buy debugging and replay at the cost of a central store holding every team's prompts.

A **shared model gateway** carries every team's model calls, so its **request log** can hold every team's prompts and answers in one place. That makes it the most useful debugging and replay source in the company and also one of its most sensitive stores: it gathers support transcripts, contract text and internal plans that used to live in separate applications. By default, the people who run the gateway would be able to read all of it. When legal asks who can read the logged prompts, the answer has to be a design, not a reassurance. ## Two tiers, chosen per route A **route** here is one named entry point at the gateway, usually one feature or one team's use case. Each route gets one of two logging tiers. | Tier | What it records | What it enables | Who reads it | |---|---|---|---| | **Metadata** | team, gateway key id, route, resolved model, token counts, latency, status, finish reason, a hash of the prompt | cost and latency reporting, error alerts, capacity planning, spotting template changes | the owning team, the platform team, finance views | | **Full body** | the request messages and parameters as sent, and the full response | debugging a bad answer, replaying traffic on a candidate model | the owning team; others only by audited exception | Metadata goes on every route. Bodies are a per-route choice, because routes differ: an internal code-review helper on non-personal data and a customer-support assistant reading account details should not share one switch. ## Deciding which routes log bodies 1. **The route owner declares the data class** the route handles when it is onboarded, and the gateway stores that declaration with the route's configuration. 2. **Bodies need a stated purpose,** such as debugging during a launch or replaying traffic before a planned model migration. 3. **Sensitive data classes need approval** from whoever owns privacy decisions before bodies are turned on. 4. **Body logging is reviewed,** with an owner and a review date, so a launch-week setting does not run forever unnoticed. The default for new routes is the lead's call. Defaulting to bodies buys debuggability and replay at no extra effort; defaulting to metadata means a route that later needs a migration must ask first. A common middle position is bodies by default for internal, non-personal routes and metadata by default for anything that may carry customer data. ## Who may read what - **The owning team** reads its own route's bodies; it already holds that data in its application. - **Platform engineers** read metadata freely and bodies only through a **break-glass** grant: scoped to one route, time-boxed, with a reason, and logged. - **Security and legal** read the **access audit**, the record of who read which bodies and when. That audit is the honest answer to "who can read the prompts". - **Nobody gets bulk cross-team export.** Replay jobs run inside the same boundary, and their outputs inherit the body tier of the route they came from. - **Dashboards stay on metadata.** Bodies live in a separate store with separate permissions, and often separate encryption keys, so access to a cost dashboard never grants access to prompts. ## Traps worth naming - **Encryption at rest is not access control.** It protects against a stolen disk, not against a colleague with query rights. - **A prompt hash is not anonymous.** It lets you count repeats and join records without storing text, but short or predictable prompts can be guessed and checked against it, so hashes still get care. - **No bodies, no replay.** A metadata-only route cannot be debugged from the log or replayed on a candidate later; its owner must know they are choosing that. - **Bodies in tickets.** If reading bodies is hard, people paste them into bug reports and chats, which is worse than an audited read path. Make the controlled path the easy one. ## What this leaves to other topics Detecting and redacting personal data before a record is written, how long bodies are kept, provider-side retention and making deletion requests reach logs are part of handling personal data in prompts and traces. The payload capture policy for in-app spans is a tracing decision. This question is the gateway's own: which routes log bodies, and who may read them. ## The calls a lead owns - The default tier for new routes, and who may change it. - Who approves bodies on sensitive data classes. - Whether platform engineers get break-glass at all, or must ask the owning team every time. - How much debuggability and replay coverage the organisation will give up for a smaller central store of prompts.

  • Would you ever default new routes to full-body logging?
    For internal tools on non-personal data, often yes: debugging and later replay are worth more than the exposure, and switching to metadata later is easy. For a route that may carry customer or personal data I default to metadata and require an approved opt-in, because bodies logged before anyone classified the route are already in the store.
  • A metadata-only route now faces a model migration. What can it use instead of a replay?
    It can turn on body logging for a bounded, approved window and replay that window, or build a curated set of representative requests with the route's owners. Either way the logging tier decided in advance which routes could be replayed at all, so the gap should surface at onboarding, not at migration time.
  • Why keep a hash of the prompt in metadata-only records?
    A hash lets you count repeated prompts, notice a template change, join to a body stored elsewhere and tell whether two records are the same request, without storing the text. It is not anonymisation: short or predictable prompts can be guessed and checked against the hash, so it still gets care.

  • One global switch for body logging is simpler, so every route should share it.
  • Encryption at rest settles the question of who may read the logged prompts.
  • The engineers who run the gateway should read every team's prompts by default.
  • A metadata-only route can still be replayed on a candidate model later.
  • Hashing the prompts makes metadata records anonymous.