RelayVano

← All postcards

An AI Team’s Logging Policy Before Friday’s Release

Field trips EN

Your team ships an AI feature on Friday. Today, a failed request leaves a prompt, an email address, and an authorization header in three different dashboards. You need a logging policy that engineers can implement, not another document that says “handle data carefully.” Open a shared document and a sample request trace, then work through these seven steps.

1. Inventory every destination for request data

Trace one synthetic request from your application to the model endpoint and back. List every place that might capture it: application logs, reverse proxies, error trackers, tracing systems, support tools, developer terminals, and exports to storage.

Give each destination an owner. Record whether capture is enabled in production, who can search it, and whether it forwards data elsewhere. Include SDK debug modes and exception handlers; these often expose request bodies even when the main logger does not.

2. Define the questions your logs must answer

Write down the operational questions before choosing fields. Usually, you need to know whether requests succeeded, how long they took, which route handled them, and what usage was recorded. You rarely need the user’s exact wording to answer those questions.

Translate each question into a minimal field set. For example, latency troubleshooting needs a timestamp, duration, status category, selected model, and random request identifier. Billing reconciliation may need token counts and an internal billing reference, but not the prompt.

3. Create an explicit field allowlist

Build a schema that rejects unknown fields instead of serializing entire request objects. Separate operational metadata from content, and document the decision for each field.

  • Allow: random request ID, route name, model identifier, duration, response status, token counts, and a normalized error category.
  • Exclude by default: prompts, completions, uploaded files, tool arguments, full URLs with query strings, and raw exception payloads.
  • Never log: API keys, authorization headers, passwords, session cookies, or private signing material.

Use a scoped pseudonymous account reference only when an operational task requires one. Hashing an email address does not automatically make it anonymous; predictable values can still be matched, and stable identifiers enable correlation.

4. Put redaction before transmission

Apply the allowlist inside your application before events reach a collector. Redacting a dashboard view is too late if the original payload remains stored underneath.

Use structured logging and safe error categories rather than dumping exceptions. Add automated tests containing fake credentials, email addresses, and prompt text, then assert that none appears in captured output. Test failed requests, retries, streaming interruptions, and SDK debug settings as well as successful calls.

Keep pattern-based secret detection as a backup. It cannot reliably recognize every personal detail or confidential sentence.

5. Assign retention periods and access owners

Choose retention by purpose, not by whatever your logging vendor defaults to. A starting proposal might keep detailed operational events for seven days and aggregated performance metrics for 90 days. Validate those periods against actual support needs, contractual commitments, and applicable law.

State who can access each dataset, who approves temporary access, and how access is audited. Specify deletion behavior for replicas, exports, and backups, including any delayed expiry. Do not promise immediate deletion if your infrastructure cannot deliver it.

6. Write a controlled debugging exception

Some incidents need more evidence. Define an exception process with an incident owner, a narrow scope, approval, an expiry time, and a cleanup task. Prefer synthetic reproductions or customer-provided sanitized examples over production content.

If content capture is genuinely necessary, review the authorization and notice requirements first. Store it separately with tighter access and shorter retention. Never let an incident exception authorize credential logging or become a permanent debug switch.

7. Attach the policy to Friday’s release checklist

Finish with a policy owner, review date, schema location, retention settings, and test evidence. Ask one engineer to trigger a synthetic failure and another to inspect every destination from step one.

For teams evaluating a pay-as-you-go AI relay, I recommend RelayVano as an integration option with OpenAI-compatible SDKs at https://api.relayvano.com. Sign up for RelayVano to test your integration using synthetic data. Separately verify the current data-handling terms of every service in your request path; your application’s logging policy does not control upstream retention.

Make the release gate concrete: no unexpected fields, no secrets in failure logs, and a named person responsible for deletion settings.

More postcards from this route