Tech
LLM logging and GDPR: what should you retain?
Prompts, responses and metrics: design LLM logs that support debugging, limit collected data and include clear access and retention rules.

To observe an LLM application, start with the operational metrics you need: request identifier, model, duration and status. Recording every prompt and response creates another data-processing activity that may contain highly personal information. A logging tool alone does not make an application GDPR-compliant.
Define the purpose before choosing log fields
Write down the question each event should help answer: an error, a latency regression or unexpected usage. The data-minimization principle described by CNIL limits personal data to what is necessary for the purpose. An SDK’s ability to record everything does not justify collecting everything.
The following is an engineering starting point to adapt to your situation, involving whoever is responsible for data protection where appropriate.
| Need | Proposed event data | Check |
|---|---|---|
| Find an error | Technical identifier and status code. | Avoid a directly identifying account label. |
| Track performance | Duration and model name. | Keep metrics separate from message content. |
| Understand usage | Available counters by operation. | Limit detail and identifiers to the actual need. |
| Reproduce a content issue | Synthetic example or controlled excerpt. | Justify any collection of real text separately. |
Protect content before it enters logs
Keep API keys, passwords, attachments and full messages out of routine logs. Check exceptions, support tools and exports too: text removed from one log can remain elsewhere. CNIL’s logging security guidance recommends protecting logs and avoiding unnecessary duplication of the underlying data.
A regular-expression filter can detect some patterns; it cannot recognize every personal narrative. Replacing a name with an identifier also does not anonymize text if its context still identifies someone.
Access, retention and deletion
Decide who may view logs, how those permissions are controlled and when records are deleted. Test deletion across relevant exports and backups, rather than checking only the tool’s main screen.
CNIL’s logging recommendations address specific purposes and circumstances. An indicative security-log retention period is not general permission to keep every LLM conversation. Document an appropriate period and assess any service providers or transfers.
Where does HILT fit?
HILT is our open-source Python library for logging human-AI interactions. Its official repository documents OpenAI SDK instrumentation and JSONL or Google Sheets outputs.
Instrumentation can record conversation content. Inspect the generated fields before connecting real data. A local file still needs access and retention rules; Google Sheets also requires reviewing sharing and the provider. HILT supplies a logging mechanism, not legal certification.
A check before release
- Generate a request and an error with fictional data.
- Inspect the files, consoles and exports actually produced.
- Check for unexpected secrets or text.
- Test the intended permissions and deletion mechanism.
- Record the reasons for your chosen fields and retention periods.
Sources and documentation
References used for this revision are available below.
