Once you launch an AI feature, you'll inevitably get messages like this: "The AI gave me a weird answer yesterday." But if you have no record of what was asked, and which model answered what, it's hard to reproduce the issue or find the cause. On the other hand, if you log everything as-is, customer data piles up in your logs and costs go up too. That's why it pays to decide what to keep, what to mask or trim, and how long to retain it at the design stage.
What happens without records
An AI can give slightly different answers to the same question. So it's easy to close an issue with "I tried again and it looked fine." To reproduce a problem, you need at least these four things:
- The model name and version used at the time
- The prompt version used at the time (the change history of your system instructions)
- The actual input sent to the AI and the output that came back
- How the user received that answer (thumbs up · thumbs down · regenerate)
Item 2 is the one most often missed. To see whether the day you edited the instructions lines up with the day strange answers increased, you need to log a prompt version number with every request.
What to keep, and what to mask or trim
| Item | How to keep it | Why |
|---|---|---|
| Request ID · time · feature name | As-is | Find it right away when a question comes in |
| Model name · version · prompt version | As-is | Compare against when things changed |
| Latency · usage (tokens) | As-is | Spot slowdowns and cost spikes |
| User feedback | As-is | Find questions it often gets wrong |
| Raw input · output | Store only after masking personal data | Reproduce issues without keeping the original text |
| Error details | Error codes only, without the request body | Keep raw text out of error logs |
By default, store only the masked text for inputs and outputs. We covered how to mask values like names and phone numbers in our earlier post on masking personal data before sending it to an AI. The security organization OWASP's "Top 10 for LLM Applications (2025)" also lists sensitive information disclosure (LLM02) as a major risk and recommends sanitizing data and keeping access permissions to a minimum.
Decide the retention period up front
How long to keep logs differs by service, but not deciding at all is the riskiest choice. When setting a standard, look at your own logs and the AI provider's retention separately.
- Your own logs: Keep masked logs only as long as you need them for reproduction, and keep aggregate numbers (latency · usage · feedback) longer.
- The AI provider's retention: For example, OpenAI's API documentation says abuse-monitoring logs are retained for up to 30 days by default, and that data sent through the API isn't used for training unless you opt in. These policies differ by provider, so check the documentation before you sign up.
Turning logs into a weekly review
Logs are meaningless if you only pile them up. Once a week, 30 minutes is enough.
- Read the top 10 questions with the most thumbs-downs · regenerations and look for patterns
- Check whether slow requests cluster in a specific feature or time of day
- Check whether days with sudden usage spikes line up with days you changed the prompt or model
- Add the problem questions you find to your evaluation set so you can recheck them on the next change
References
- OWASP GenAI Security Project, LLM02:2025 Sensitive Information Disclosure: https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/
- OpenAI API docs, Data controls in the OpenAI platform: https://developers.openai.com/api/docs/guides/your-data
We review your current system and data, then outline the migration order and scope.