Why logging creates compliance risk
Logging and monitoring are essential for cybersecurity, reliability, and incident response—but they also create a parallel data store that often contains personal data (IP addresses, user IDs, device identifiers, emails, support tickets, payload fragments). That means logs can fall under GDPR/DSG obligations: lawful basis, transparency, minimization, access control, and retention.
The challenge is balancing two legitimate goals: (1) detect and respond to incidents and (2) avoid unnecessary collection and misuse of personal data.
Principles for compliant logging & monitoring
Use these principles as your “design rules” for observability systems.
1) Purpose limitation
Define the purposes: security monitoring, fraud detection, performance troubleshooting, audit trails, and service availability. Avoid “general curiosity logging” that lacks a clear operational reason.
2) Data minimization
Log the smallest amount of data needed to achieve the purpose. If you don’t need the full payload, don’t store it. If you don’t need a raw identifier, store a pseudonymized value instead.
3) Privacy-by-design for observability
- Default log levels tuned for production (avoid verbose debug logs)
- PII redaction/masking (emails, phone numbers, addresses, tokens)
- Separation of concerns: metrics/traces vs sensitive audit logs
4) Security and confidentiality
Observability platforms are high-value targets. Protect logs with access controls, encryption, and monitoring— and ensure vendors/subprocessors are governed contractually.
What to log (and what to avoid)
Compliant logging is not “no logging.” It’s logging the right events with the right fields. Use structured logging and define schemas per system component.
Recommended: event-based logging
| Category | Examples | Why it’s needed |
|---|---|---|
| Security events | Login success/failure, MFA events, privilege changes, suspicious access | Detect threats, investigate incidents, prove controls |
| Administrative actions | User creation/deletion, role changes, data export actions | Auditability and accountability |
| System reliability | Error rates, service health, timeouts, queue failures | Keep systems stable and reduce downtime |
| Data access traces | Access to sensitive records, bulk reads, unusual query patterns | Detect misuse and support breach analysis |
Avoid or tightly control
- Full request/response bodies in production (often contain sensitive personal data)
- Authentication secrets (tokens, passwords, session cookies) — never log
- Free-text logging (hard to search and easy to leak sensitive data)
- Over-collection of device fingerprints or extensive behavioral data without strong justification
Retention, deletion & access controls
A logging system is compliant when it is controlled like any other personal data store: defined retention, strong access controls, and reliable deletion.
Retention policy design
Retention is not “one size fits all.” Define retention by category (security logs vs application logs vs audit trails) and align it with incident response needs, regulatory expectations, and risk exposure.
| Log type | Typical purpose | Retention approach |
|---|---|---|
| Security monitoring | Detection + incident investigation | Longer retention with strict access and integrity controls |
| Operational / app logs | Troubleshooting | Shorter retention; avoid storing PII |
| Audit trails | Accountability for sensitive actions | Retention aligned to governance needs; protect against tampering |
Access control & auditability
- Role-based access (least privilege) for log platforms
- Separate security team access from general engineering access
- Record and review access to logs (meta-audit of the audit system)
- Export controls: restrict bulk export of logs
Deletion & data subject requests
Logs can complicate deletion requests. In many cases, organizations can keep certain security/audit logs when they are necessary for security or compliance purposes—but you should minimize PII so you can avoid case-by-case manual handling.
Operational support (optional)
A compliant logging program needs evidence: policies, approvals, reviews, and audit trails for privileged access. Secure workflow tooling can help document these steps and show accountability.
Disclaimer: Links are for convenience. Choose tools based on your requirements and compliance needs.
Logging & monitoring compliance checklist (copy/paste)
Use this checklist to assess your observability stack (apps, cloud, SIEM, APM, tracing, vendor tools).
- We documented the purpose of logging/monitoring per system (security, reliability, fraud, auditability).
- We defined a log schema and removed free-text PII logging where possible.
- We redact/mask sensitive fields (tokens, passwords, session cookies, payment data).
- We set production log levels to avoid verbose payload logging by default.
- We separated log categories and applied retention policies per category.
- Retention deletion is automated and verified (storage lifecycle rules).
- Access to log platforms is least-privilege with regular access reviews.
- Privileged log access and exports are monitored and audited.
- Vendor DPAs/subprocessors for logging tools are reviewed and documented.
- Incident response playbooks include how to use logs without overexposing personal data.
FAQ
Are IP addresses in logs personal data under GDPR?
Can we keep logs “forever” for security?
How do we handle data deletion requests if logs contain user identifiers?
What is the difference between logs and audit trails?
Sources & further reading
Use security and privacy standards to define logging controls, retention, and auditability.
- ISO/IEC 27001 – Information Security Management
- ISO/IEC 27002 – Security controls guidance
- NIST Cybersecurity Framework
- OWASP – Logging Cheat Sheet
- ISO/IEC 27032 – Cybersecurity guidelines
Last updated: February 22, 2026 • Version: 1.0