GDPR & PII in logs

7 min readUpdated June 29, 2026

Logs are full of personal data — IP addresses, user IDs, emails, sometimes far more — which means the GDPR applies to them. That creates a tension: security and operations want to keep logs, while data-protection law says minimise and don't keep personal data longer than needed. This guide explains how the GDPR applies to logs and how to handle PII responsibly.

Not legal advice

This is general guidance, not legal advice. How the GDPR applies to your logs depends on your data, purposes and jurisdiction — involve your DPO or legal counsel for specifics.

Logs contain personal data

Under the GDPR, personal data is any information relating to an identifiable person. Logs routinely contain it: usernames, user IDs, email addresses, and IP addresses — which EU case law (the CJEU Breyer ruling) treats as personal data in many contexts. So a log store is a store of personal data, and the GDPR's principles apply to it.

The GDPR principles that bite

  • Data minimisation (Art. 5) — only log the personal data you actually need for the purpose.
  • Storage limitation (Art. 5) — don't keep personal data longer than necessary; define and justify a retention period.
  • Purpose limitation (Art. 5) — use the logs for the purpose you collected them for (e.g. security, troubleshooting).
  • Integrity & confidentiality (Art. 5 & Art. 32) — secure the logs: access control, encryption, and where appropriate pseudonymisation.

Helpfully, the GDPR explicitly recognises network and information security as a legitimate interest (Recital 49) — a common legal basis for security logging — but that does not exempt you from the principles above.

The right to erasure vs. immutable logs

The right to erasure (Article 17, "right to be forgotten") sits awkwardly with logs you deliberately keep tamper-evident for security and compliance. The usual resolution: security logging under a legitimate-interest or legal-obligation basis can justify retaining logs for a defined period despite an erasure request, and pseudonymisation or redaction reduces the personal-data footprint so erasure is less often required in the first place.

How to handle PII in logs

  1. Don't log what you don't need — keep secrets, full payloads and excess personal data out of logs at the source.
  2. Redact or pseudonymise at ingest — mask or hash PII in a log pipeline before it is stored.
  3. Set a justified retention period — and document the basis; see log retention requirements.
  4. Secure the store — access control, encryption in transit and at rest, audited access.
  5. Mind data residency — where EU data-protection drives your obligations, keeping log data in the EU simplifies compliance.

Redaction beats deletion

The cleanest way to reconcile security logging with the GDPR is to never store the sensitive value in the first place — redact or pseudonymise PII in the pipeline, so the log keeps its investigative value without holding unnecessary personal data.

How LogPulse helps with PII in logs

LogPulse runs visual pipelines that can redact or mask PII before storage, supporting data minimisation and storage limitation. Log data stays in the EU (GCP Amsterdam) and AI evaluation runs in an EU region, which simplifies GDPR obligations when EU law drives them. See structured logging for getting clean, field-level data that is easy to redact, and NIS2 for the security-regulation side. LogPulse supports your compliance programme; it is not itself a certification.

Frequently asked questions

Does the GDPR apply to logs?
Yes. Logs routinely contain personal data — usernames, user IDs, email addresses, and IP addresses (which EU case law treats as personal data in many contexts). A log store is therefore a store of personal data, and the GDPR’s principles apply to it.
How long can you keep logs under the GDPR?
The GDPR sets no fixed number but applies the storage-limitation principle: keep personal data only as long as needed for the stated purpose, and justify the period. For security logs, network and information security is a recognised legitimate interest (Recital 49), which commonly supports a defined retention window.
How do you handle the right to erasure for logs?
Security logging under a legitimate-interest or legal-obligation basis can justify retaining logs for a defined period despite an erasure request. Pseudonymising or redacting personal data in logs reduces the footprint so erasure is less often required in the first place.
How do you handle PII in logs?
Avoid logging secrets and unnecessary personal data at the source, redact or pseudonymise PII at ingest before storage, set and document a justified retention period, secure the store with access control and encryption, and — where EU law applies — keep log data in the EU.

Logging and monitoring, on one EU-hosted engine

Centralise, retain and monitor your logs with AI-assisted search and a risk-based SIEM — GDPR-compliant and hosted in the EU. Start free.

Start free

We use cookies to analyze site traffic and improve your experience. No cookies are placed without your consent. Privacy Policy