
Security logs are full of personal data. A single sign-in record holds a username, an Internet Protocol (IP) address, a device name and a time. The General Data Protection Regulation (GDPR) says you may keep personal data only as long as you need it. Your security team says it needs months of history to investigate a breach that was found late. Both are right, and the tension lands on one question: how long can you keep logs?
This guide answers it from the official texts: the Regulation itself, guidance from the European Data Protection Board (EDPB), and the most specific advice any regulator has published, from France’s data protection authority (CNIL). It covers the European Union (EU) GDPR, and the same principles apply under the UK GDPR.
The short answer: GDPR does not set a log retention period. Article 5(1)(e) says personal data may be kept “for no longer than is necessary for the purposes” you collected it for, and Article 5(2) says you must be able to prove that. For security logs, the purpose is detecting and investigating attacks, which Recital 49 accepts as a legitimate interest. The only regulator figure is CNIL’s recommendation of six months to one year for application access logs, with longer periods allowed when you justify and document them. If another law sets a minimum, such as the 12 months that the Payment Card Industry Data Security Standard (PCI DSS) asks for card system audit logs, that law decides the floor.
How to pick a retention period for one type of log
GDPR names no number, so the period comes from your purpose and from other rules
Why GDPR applies to logs at all
GDPR covers any information about a person who can be identified, directly or indirectly. Article 4(1) lists “an online identifier” as one way a person can be identified, and Recital 30 names IP addresses as an example. Usernames, email addresses and device names point to people even more directly.
The Court of Justice of the EU reached the same view about IP addresses in the Breyer case (C-582/14, 19 October 2016). The case was decided under the older 1995 Data Protection Directive, but the reasoning carried over. A dynamic IP address is personal data for a website operator that has the legal means to identify the person, with the help of extra data the internet provider holds.
A log can also be personal data about the person who acted, such as the administrator who opened a record. The EDPB says so in footnote 26 of its 2022 breach guidelines, and CNIL notes that access logs can reveal how employees work. So treat every security log as personal data unless you have stripped the identifiers out.
The legal basis for keeping security logs
You need a lawful basis for any processing under Article 6. For security logs, two bases do the work.
- Legitimate interests, Article 6(1)(f). Recital 49 says processing to ensure network and information security is a legitimate interest, to the extent “strictly necessary and proportionate”. Its examples are stopping unauthorised access, the spread of malicious code and denial of service attacks. This is the basis most private companies rely on.
- Legal obligation, Article 6(1)(c). When another law requires you to keep logs, that duty is your basis. Examples are the logging rules in the NIS2 Directive’s implementing regulation, sector rules for banks, or a public body’s own law. Note that public authorities cannot use legitimate interests for their official tasks, so they rely on this basis or on Article 6(1)(e).
Consent is the wrong basis for security logs. Article 7(3) lets people withdraw consent at any time, and you cannot stop logging one employee because they changed their mind.
Article 32 adds a duty of its own: you must protect personal data with measures that fit the risk. It names restoring access after an incident and “a process for regularly testing, assessing and evaluating” security measures. You cannot do either well without logs. So GDPR both limits how long you keep logs and expects you to have them.
What the texts actually say about how long
No text sets a single number. Here is what each one says, with the exact source.
| Source | What it says about log retention | Binding? |
|---|---|---|
| GDPR Article 5(1)(e) | Keep identifiable data no longer than the purpose needs | Yes |
| GDPR Recital 39 | Keep storage to “a strict minimum”; the controller sets time limits for erasure or periodic review | Explains the Articles |
| GDPR Article 25(2) | By default, process only what each purpose needs, including “the period of their storage” | Yes |
| GDPR Article 30(1)(f) | Your record of processing should list, where possible, the time limits for erasure | Yes |
| EDPB Guidelines 4/2019, paragraphs 82 and 85 | Decide how long logs are needed; keep them only as far as needed for security, protect them and review them | Guidance |
| CNIL deliberation 2021-122, paragraph 8 | Six months to one year for application access logs | Recommendation |
| Regulation (EU) 2024/2690, Annex point 3.2.5 | Keep and back up logs “for a predefined period” you set | Yes, for the digital providers it covers |
| PCI DSS 4.0, Requirement 10.5.1 | At least 12 months of audit logs, the latest 3 months immediately available | Yes, by contract, for card data systems |
How many months of logs each text names
From the sources in the table above
What CNIL’s recommendation really covers
CNIL’s recommendation is the figure most articles quote, often wrongly. Read in full, it says five things.
- It is not binding. Paragraph 1 says it is neither prescriptive nor exhaustive.
- It covers application logs: who accessed, created, changed or deleted data inside a system. Paragraph 2 leaves out “perimeter” logs from network equipment such as firewalls.
- The suggested period is six months to one year (paragraph 8).
- Longer periods are possible. Paragraphs 16 to 21 accept more than a year for internal control, with up to three years justifiable in the most common cases. A legal duty or the analysis of an attack can justify longer still. The possibility of a future lawsuit, on its own, is not a valid reason.
- The logs must be protected and used. CNIL asks for separate storage with access limited to strict need (paragraph 7), regular analysis with alerts (paragraph 9), and timestamps and signatures at creation (paragraph 12).
So “GDPR requires six months of logs” is false, and so is “GDPR forbids keeping logs more than a year.” What regulators expect is a period tied to a purpose, written down, and enforced.
Why too short is also a risk
Storage limitation gets the attention, but deleting logs too early creates its own GDPR problem. Article 33(1) gives you 72 hours from becoming aware of a breach to notify the supervisory authority, unless the breach is unlikely to put people at risk. Article 33(5) requires you to document every breach: “facts relating to the personal data breach, its effects and the remedial action taken.”
You can only state those facts if the logs still exist. Many intrusions are found weeks or months after the first login. If your logs roll over after 30 or 90 days, the record of how the attacker got in may be gone by the time you look.
How a short retention window can erase the start of a breach
An illustration, not real data
- Day 1Attacker signs in with a stolen passwordOne remote access login from an address never seen before
- Day 40Data starts to leaveSmall exports spread over several weeks
- Day 91A 90-day window deletes the first loginThe evidence of how they got in is removed on schedule
- Day 150The breach is foundArticle 33 gives 72 hours to report what you know
Without that record, you cannot show which people were affected, and you may have to treat a much larger group as affected. A period that is too short fails the accountability test in Article 5(2) as surely as one that is too long.
Five steps to a retention period you can defend
The goal is a period for each log type, a reason for each period, and proof that deletion happens on time.
Five steps to a log retention period you can defend
Repeat them when you add a new log source
- ListEach log type, where it is stored and which personal data it holds
- PurposeSecurity, a legal duty, or operations
- PeriodOne per log type, checked against other laws
- ProtectLimit access, encrypt, drop fields you do not need
- Record and deleteArticle 30 record, deletion that runs by itself
1. List every log type. Include sign-ins, firewall and proxy records, endpoint events, cloud audit logs and access logs from applications that hold personal data. Our guide to what logs should be sent to a SIEM gives a priority order. Note which fields identify people.
2. Name the purpose. Security monitoring and investigation is one purpose. Meeting a specific legal duty is another. Troubleshooting is a third, and it usually needs far less history.
3. Set a period for each type. Start from any legal minimum, then add what your investigations need. The table below is an example only, not legal advice.
| Log type | Why you keep it | Example period |
|---|---|---|
| Sign-ins to the identity provider, remote access and domain controllers | Find account takeover and trace an attacker’s first step | 12 months |
| Administrator and privileged actions | Show who changed what, and when | 12 months or longer |
| Access logs of systems holding personal data | Show which records were opened, for breach scope | 6 to 12 months, longer if a sector law says so |
| Firewall, proxy and Domain Name System (DNS) logs | Trace connections and data leaving the network | 6 to 12 months |
| Public website access logs | Spot attacks and abuse | 3 to 6 months |
| Debug logs with request contents | Fix faults | Days, and avoid personal data in them |
4. Protect and minimise. Article 32 and EDPB paragraph 85 expect logs to be protected. Limit who can search them, encrypt them, and keep them off the systems they describe, so an attacker or an insider cannot edit them. Drop fields you do not need before storage. Never log passwords or full message contents.
5. Write it down and delete on time. Put each period in your Article 30 record. Tell staff and users about the logging and its retention, as Article 13(2)(a) and CNIL paragraph 13 expect. Then make deletion automatic. A written policy that nobody enforces is the weakest position, because it shows you knew the limit and kept data anyway.
Two exceptions are worth writing into the policy now. During an active investigation or a legal hold, you can keep the relevant logs longer, because Article 17(3)(e) allows data needed for legal claims. Note the reason and the date the hold ends.
How UTMStack fits
We build UTMStack, a security information and event management (SIEM) platform, so weigh our view accordingly. Here is what it does for log retention under GDPR, and where it stops.
- You decide where the logs live. The free Community edition installs on your own Linux server, so logs stay in your data centre or your own cloud account. If we host it, UTMStack Cloud is a dedicated instance per customer on OVHcloud, and France and Poland are among the regions, which keeps the logs inside the EU. When we host your logs we process them on your behalf, so Article 28 expects a written contract covering that; ask for it with your quote.
- Retention that deletes on its own. On the Data retention page you set a “Delete after” age in days for logs, and a separate one for alerts. A record is deleted that many days after it happened, wherever it is stored by then. That is step five without a manual job.
- Long history without big disks. Older records can move to object storage after a set number of days and stay searchable from the same screen, with nothing to restore. Retention can run up to five years. See log management for how the hot and cold tiers work.
- Minimise before storage. Parsers, called filters in the console, can be edited to delete fields you do not need before a record is stored.
- Detection for the 72-hour clock. More than 600 detection rules, mapped to MITRE ATT&CK, are checked as each log arrives, before it is stored. That shortens the time between an intrusion and the moment you become aware of it, which is when the Article 33 clock starts.
- A free GDPR checklist. The GDPR framework is included in the free Community edition, alongside CMMC 2.0. See compliance.
The limits matter just as much:
- One lifetime for all logs. Retention is set per dataset (logs, alerts and ingestion statistics), not per log source. You cannot keep firewall logs for six months and sign-in logs for twelve in the same instance. If your schedule needs different periods, set the longest one you can justify and drop fields or sources you do not need.
- The GDPR view is a checklist, not an automatic verdict. In the current version it lists Articles 5(1)(f), 30 and 32 to 34 and maps them to controls, but those controls are not yet evaluated against your data. Use it to track your work, not as proof of compliance.
- No built-in pseudonymisation and no per-person erasure tool. UTMStack does not replace identifiers with pseudonyms for you, and it cannot find and delete one person’s entries across stored logs. Plan erasure requests around your retention period and filters.
UTMStack is priced per device, never by log volume, so keeping a year of logs does not raise the bill the way per-gigabyte pricing does. For a quote, see pricing or ask us. To estimate the disk a year of logs needs, use our SIEM sizing calculator.
Related guides: NIS2 logging requirements, PCI DSS logging requirements and our GDPR compliance checklist.
Frequently asked questions
Is there a GDPR log retention period? No. GDPR sets no retention period for logs or for any other data. Article 5(1)(e) says to keep personal data no longer than its purpose needs, and Article 5(2) says you must be able to show that. You set the period, write down why, and delete on time.
Is an IP address personal data under GDPR? Usually, yes. Article 4(1) includes online identifiers, and Recital 30 names IP addresses. The Court of Justice found in Breyer (C-582/14) that a dynamic IP address is personal data when the operator has legal means to identify the person through the internet provider. Treat security logs that hold IP addresses as personal data.
Do I need consent to keep security logs? No. Most organizations rely on legitimate interests under Article 6(1)(f), which Recital 49 accepts for network and information security, as long as the processing is strictly necessary and proportionate. Where a law requires logging, Article 6(1)(c) applies. Consent would be a poor fit, because people can withdraw it at any time.
Can I keep security logs for five years under GDPR? Yes, if you can justify it. CNIL suggests six months to one year for access logs, accepts more than a year for internal control, and accepts longer periods for a legal duty or the analysis of an attack, as long as you document the reason. Without such a reason, five years of personal data in logs is hard to defend.
Do I have to delete someone’s log entries if they ask? Not always. When logs rest on legitimate interests, a person can object under Article 21, and you may keep the data if you show compelling legitimate grounds, such as security. Article 17(3)(e) also lets you keep data needed for legal claims. Record each decision and its reason.
Does the UK GDPR set a different period? No. The UK GDPR keeps the same storage limitation principle and sets no period for logs. The guidance from the UK regulator, the Information Commissioner’s Office, opens with the same rule: do not keep personal data for longer than you need it.
Sources
- Regulation (EU) 2016/679 (GDPR), Articles 4, 5, 6, 7, 13, 17, 21, 25, 28, 30, 32, 33, 34 and 83, and Recitals 30, 39 and 49: https://eur-lex.europa.eu/eli/reg/2016/679/oj
- Court of Justice of the EU, Breyer, case C-582/14, judgment of 19 October 2016: https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:62014CJ0582
- CNIL, deliberation no. 2021-122 of 14 October 2021, recommendation on logging measures (in French): https://www.cnil.fr/sites/cnil/files/atoms/files/recommandation_-_journalisation.pdf
- EDPB, Guidelines 4/2019 on Article 25, Data Protection by Design and by Default, version 2.0: https://www.edpb.europa.eu/sites/default/files/files/file1/edpb_guidelines_201904_dataprotection_by_design_and_by_default_v2.0_en.pdf
- EDPB, Guidelines 9/2022 on personal data breach notification, version 2.0: https://www.edpb.europa.eu/system/files/2023-04/edpb_guidelines_202209_personal_data_breach_notification_v2.0_en.pdf
- Commission Implementing Regulation (EU) 2024/2690, Annex points 3.2.3 to 3.2.6: https://eur-lex.europa.eu/eli/reg_impl/2024/2690/oj
- UK Information Commissioner’s Office, storage limitation principle: https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/data-protection-principles/a-guide-to-the-data-protection-principles/storage-limitation/
- PCI Security Standards Council, PCI DSS v4.0.1, Requirement 10.5.1: https://www.pcisecuritystandards.org/document_library/


