Video in progress

Telemetry can contain personal data. If a user asks for their data to be deleted (GDPR or a local law), what do you do about logs and traces?

The best strategy is to keep PII out of telemetry altogether, or to include only a pseudonymized identifier, and to keep retention short. Then a deletion request barely touches telemetry. For the rest, write down what sits in which system and for how long.

📖 Answer

Log and trace storage systems are not designed for selective deletion. Removing one user's lines from a compressed chunk in Loki, or from immutable object storage, is expensive or impossible in practice. So you have to solve the problem at write time.

  1. Data minimization: you don't need names, phone numbers, emails, addresses or card numbers in telemetry. An internal ID is usually enough for debugging. Libraries and code review hold this line.

  2. Pseudonymization: if you need to link to the user, use a keyed hash (HMAC) or an internal surrogate ID instead of userId. The key is stored separately. One approach is "crypto-shredding": a key per user, and on a deletion request you destroy the key, so the values in telemetry become meaningless.

  3. Automatic cleanup: redaction in the OpenTelemetry Collector:

processors:
  redaction:
    allow_all_keys: true
    blocked_values:
      - "\\b[\\w.+-]+@[\\w-]+\\.[\\w.]+\\b"   # email
      - "\\b\\d{16}\\b"                          # card number

This is a safety net: it catches mistakes at the code level, but it doesn't replace the main protection.

  1. Retention policy: application logs 14-30 days, traces 7-14 days. The law usually allows deletion "without undue delay" within a reasonable period, and short automatic retention is in many cases a sufficient answer. But this has to be agreed with lawyers; an engineer doesn't decide it alone.

  2. A map: a document that says which data is kept in which system (Loki, Tempo, S3 archive, backups, vendor SaaS) and for how long. You hand this document over when an auditor or the DPO asks.

A practical warning: exporting logs "temporarily" to a local machine or a chat during an incident creates an uncontrolled copy. The policy must cover that too.