Yes, personal data in application logs is subject to the GDPR when a person can be identified from it, directly or indirectly. Keep logs useful by deciding which fields you need, removing or pseudonymising identifiers at the point of writing, setting retention limits, and restricting who can read them.
Key takeaways
- Any log field that can single out a person, alone or combined with other data, counts as personal data.
- Remove or pseudonymise identifiers where the log line is written, not later in a reporting tool.
- Set a retention period for each log stream based on the purpose that stream serves.
- Restrict read access to logs and treat backups and third-party log platforms as part of the same scope.
Is personal data in logs covered by the GDPR?
Yes. Under the General Data Protection Regulation, personal data means any information relating to an identified or identifiable natural person, and an identifier can be a name, an online identifier, or anything else that singles someone out. The definition appears in Article 4(1) of Regulation (EU) 2016/679, and it does not depend on whether the data sits in a database, a file or a log stream.
This article is general information and not legal or tax advice.
A log line is therefore covered as soon as it contains something that can be linked back to a person. An IP address, a user ID, an email address or a session token written next to an action such as "invoice downloaded" is enough. Because logs are collected automatically and kept for long periods, they tend to accumulate personal data without anyone deciding that they should.
Which fields in a log line are personal data?
Direct identifiers are the easy part to spot. The harder cases are combinations: a timestamp, a postcode and a device identifier can single out one person even when no single field does on its own.
- Direct identifiers: names, email addresses, phone numbers and national register numbers.
- Account identifiers: user IDs, customer numbers and order numbers that map back to a person.
- Network and device identifiers: IP addresses, device identifiers and cookie values.
- Free text: request bodies, search queries and error messages that echo user input.
- Authentication material: tokens, session IDs and password reset links, which are also a security risk.
How do you keep logs useful without identifiers?
Log events and outcomes first, and add an identifier only when you need to follow one user's journey through the system. Most debugging work needs the sequence of events and an error code, not the full personal profile behind them. The table below compares common approaches and where each one stops working.
| Approach | What it keeps | Where it fails |
|---|---|---|
| Drop the field at source | The event and its outcome | Support staff cannot trace one user's problem across requests |
| Mask a value, for example truncating an IP address | A coarser network location | Can still identify a person on small or single-user networks, so judge each case |
| Keyed pseudonym (for example an HMAC with a secret key) | A consistent link between events for one person | Anyone holding the key can re-link events, so the key must sit apart from the logs and follow a rotation policy |
| Unkeyed hash of an email address | A value that looks anonymous | Common inputs can be guessed and checked, so the value remains personal data |
Pseudonymised data is still personal data under the GDPR, because a person can be re-identified with additional information. The regulation sets this out in its recitals, so read the text of Regulation (EU) 2016/679 before relying on any hashing scheme as a substitute for deletion.
How long should application logs be kept?
Keep each log stream only for the shortest period that serves its documented purpose, and write that period down before you configure retention. The storage limitation principle in Article 5(1)(e) of Regulation (EU) 2016/679 expects personal data to be kept no longer than necessary for the purposes for which it is processed.
In practice, a single retention setting for every log is the most common mistake. Debugging streams usually need a short window, while security audit logs may justify a longer one. Each stream should therefore have its own purpose, owner and deletion schedule.
- Map every log stream to one stated purpose.
- Separate security audit logs from application debug logs.
- Apply the same deletion schedule to backups, or document why backups differ.
- Check where any third-party log platform stores data and how long it keeps it.
Who should be able to read logs?
Only the people and services that need a specific log stream for a specific task should have read access, and each grant should be reviewed. Broad access to production logs is one of the most common ways personal data leaks inside an organisation, even when the logs themselves are well designed.
Role-based access control is the usual starting point. Developers working on a laptop should not copy production logs into chat tools, spreadsheets or local files, because those copies fall outside the retention and access rules you set. Our cloud and DevOps service covers how access and environments are typically separated, and our guide on securing cloud infrastructure sets out a baseline for European SMEs.
Where do logging plans fail in practice?
Logging plans usually fail at the edges, not in the main application code. The main application may log cleanly while a neighbouring component quietly records far more than anyone intended.
- Stack traces and exception messages that include request bodies or user input.
- Error trackers and monitoring agents that capture full requests by default.
- Debug flags left enabled after an incident investigation.
- Integration middleware that logs every message passing between systems. This is a common issue when connecting an ERP and an e-commerce platform, which is covered in our system integration work.
A review should therefore cover every component that writes or forwards logs, not only the application you are building.
Hypothetical examples of log redaction
Here are two hypothetical scenarios:
Scenario one: an order service writes the full delivery address on every checkout attempt. The team changes the logger to record the order ID and an error code, and moves the address to the order database, where access is controlled. The failure point is a retry job that still reads the old field, so the change has to be tested end to end rather than only in the service that was edited.
Scenario two: a web application logs search queries in full. Users sometimes type names or sensitive terms into the search box. The team limits the default log to the query category and the result count, and keeps raw queries only in a short-lived debug stream with restricted access. The failure point here is a debug flag that stays on in production after the investigation ends, so the flag needs an expiry date.
Frequently Asked Questions
Does a hashed IP address still count as personal data?
Usually yes, because a hashed IP address can often be reversed by testing likely addresses against the hash. Whether a specific scheme is enough depends on your data and context, so confirm the approach with your data protection officer. Rui Codex can provide technical implementation support for the scheme you choose.
How long should we keep application logs?
Keep each log stream for the shortest period that serves its documented purpose, and write that period down before configuring retention. Debugging logs usually need a much shorter window than security audit logs. Check backups and third-party platforms too, because deleting data from the primary store alone does not complete the job.
Can we log user IDs for troubleshooting?
Yes, a user ID is often needed for troubleshooting, but it is personal data and must be justified, protected and retained only as long as necessary. Many teams log an internal ID rather than an email address, which limits what a leaked log file reveals. Restrict access to the stream and record its purpose in your processing documentation.
Do we need a legal review before changing our logging?
Changing what a system logs is a processing decision, so involve whoever is responsible for data protection in your organisation before rolling it out. A technical review can identify which fields carry personal data, but choosing the lawful basis and retention period is a legal matter. Rui Codex offers technical implementation support for logging changes and can work alongside your legal team.
Conclusion
Useful logging and GDPR compliance do not conflict when the design starts with purpose. Decide which events you need, remove or pseudonymise identifiers where the log line is written, give each stream its own retention period, and limit who can read it. Review every component that writes or forwards logs, including backups and third-party tools, because that is where plans most often fail. If you are changing your logging and want a technical second opinion, request a project consultation or email info@ruicodex.com.