Question Clearly sourced

Expert knowledge for digital decisions

How to Log AI Requests Compliantly?

Short answer

Only what is necessary for operation, security, and proof is logged: time, pseudonymous user ID, model and prompt version, status, token counts, and correlation ID. Complete prompts and responses are excluded from the log by default; if content is necessary, purpose, legal basis, access protection, and a fixed deletion period are required.

Metadata First, Content Only When Justified

AI requests may contain personal data, trade secrets, or special categories. Therefore, logging begins with a catalog of purposes: operational diagnostics, security monitoring, billing, or quality control are described separately. Article 5 of the GDPR requires, among other things, purpose limitation, data minimization, and storage limitation; Article 32 requires risk-appropriate technical and organizational measures.

A minimal operational event may include timestamp, pseudonymous user or service ID, tenant, correlation ID, model and prompt version, endpoint, token counts, runtime, status code, and error class. The clear name is often not necessary for this. The full text of input, RAG references, and response is not stored by default. Vectors or seemingly anonymized prompts are also not automatically free from personal reference.

If content samples are required for quality or abuse analysis, this is activated separately: clear purpose, narrowly defined user group, encryption, documented legal basis, filters for secrets, and a fixed deletion period. Retention periods such as 30 days for operational logs and 90 days for security events are possible internal starting values, not statutory blanket periods. The period must be derived from purpose, risk, and other obligations.

The BSI requires in component OPS.1.1.5 that security-relevant events be logged appropriately, stored securely, evaluated, and disposed of. Practically, log accesses are logged themselves, roles are separated, transmission and storage encryption are used, and deletion runs are monitored. Rights of the affected, incident response, and if necessary, a data protection impact assessment must include the logs. In development and support, real production prompts are not copied unchecked; reproducible error cases are provided as synthetically or redacted as possible.

Key facts

Standard
Log metadata, 0 full texts without justified release
Example Periods
30 days for operations and 90 days for security only as internal starting values
Legal Framework
Articles 5 and 32 of the GDPR

Sources

All external claims are backed by traceable sources.
  1. 01
  2. 02
    OPS.1.1.5 Protokollierung Bundesamt für Sicherheit in der Informationstechnik (BSI)
  3. 03
    NIST SP 800-53 Rev. 5.1 – Security and Privacy Controls National Institute of Standards and Technology (NIST)

Ready for your next project?

Free initial consultation - no sales pressure, just clear answers.

Request consultation