Programming

Choose What Your Prompt Logs Keep Before You Ship

A team decides to remove user prompts from its application logger. A week later a synthetic marker still appears in an error trace. The new policy covered one success path, while a retry wrapper attached the original request as an exception attribute. Define a policy at every serialization boundary where the request can leave the application. Decide with fields and destinations Start with the minimum diagnostic question. Routing analysis might need an approved model identifier, a duration, bound

A team decides to remove user prompts from its application logger. A week later a synthetic marker still appears in an error trace. The new policy covered one success path, while a retry wrapper attached the original request as an exception attribute. Define a policy at every serialization boundary where the request can leave the application.

Decide with fields and destinations

Start with the minimum diagnostic question. Routing analysis might need an approved model identifier, a duration, bounded status categories and token counts. It seldom needs the user's raw text. Give permitted fields explicit types and validate nested structures; an allowed object must not become an unrestricted container for new text fields. Prefer a template version identifier for stable system prompts. An unkeyed hash of a short or predictable message still allows someone to test guesses and reveals repeated values. OpenTelemetry describes how operators can minimize sensitive telemetry and handle recorded attributes.

If exceptional incident analysis needs raw content, document its purpose, authorized readers and time limit. Keep the restricted payload out of the ordinary log. Treat even a reference as sensitive if it grants access. Enforce access at the store, and check what happens to exports, backups and replicated copies under the retention policy.

Follow a synthetic marker

Use a different inert marker in the user message, retrieval result and tool response. Exercise a successful request, validation failure, retry and cancellation. Search the actual authorized sinks after their normal ingestion delay, including application logs, traces and error reporting. Confirm the allowed counters arrived as well; a silent logging failure would otherwise appear to pass the privacy check. Cover a newly added nested field and malformed input.

One negative search is bounded by the paths and retention periods inspected. Keep a record of the sink, time window and test marker set, along with access and expiry checks for restricted data. The result is a regression fixture for the team's own logging architecture.

Test a marker through an error-only path

Put different synthetic markers in user input, a nested tool field and a new unknown field. Trigger a controlled validation error and a retry using fixtures. Verify that all three markers stay out of ordinary error logs and exported spans while the allowed request ID and status remain observable. Record the ingestion delay and the sinks searched. A missing request ID means the check cannot distinguish successful redaction from a missing event.

This article was created with AI assistance.