Prompt Logging Without Leaking Sensitive Data
Use immutable prompt versions, safe metadata, and tested redaction boundaries to investigate AI behavior without routine transcript capture.
Design chat logs around conversation references, turn identifiers, message state, delivery evidence, and deliberate content collection.
A chat interface combines several events that users experience as one exchange. A message may be accepted, queued, processed, streamed, and presented. Give the conversation an opaque reference and each turn a distinct identifier. Preserve which turn caused a model request or tool action, especially when users send another message before earlier work finishes.
Define how edits and retries appear in the record. Editing a message can change the context supplied to later operations. Keep a safe version reference and a relationship to the earlier turn instead of overwriting history in a way that makes old execution records ambiguous.
Separate server acceptance from client receipt and from any explicit presentation acknowledgment. Record only the state your application can establish. Sending a fragment toward a browser does not prove the user read it. If the connection closes, preserve the last confirmed message state and whether response generation was cancelled or left unresolved.
Use actor types such as user, assistant, and tool where useful, with safe identifiers for correlation. Avoid using message text as an event name or metric label. A bounded reason code can explain a rejected turn without duplicating the rejected content in every monitoring destination.
Conversation content deserves a separate collection decision from operational metadata. Start with identifiers, state transitions, configuration references, and sizes. If a diagnostic sample is necessary, define its scope, access, and expiration, and apply the same review to attachments and model responses.
The prompt privacy and versioning guide explains how configuration references and tested redaction support investigation. The suggested fields below help describe the chat lifecycle; adapt them to the actual acknowledgments and retention boundaries of the application.
Illustrative field suggestions for your own event contract. Adapt the names, values, and collection rules to your system.
| Field | What it helps explain |
|---|---|
conversation_ref | Correlate a conversation without using identifying text. |
turn_id | Identify a single turn or its versioned successor. |
message_state | Describe acceptance, processing, or completion at a known boundary. |
delivery_outcome | Preserve the strongest delivery evidence actually observed. |
actor_type | Distinguish user, assistant, and tool contributions. |
content_capture | State whether approved diagnostic content was collected. |