Data Retention

The practice of defining how long an organization keeps data before archiving or permanently deleting it, balancing legal and investigative needs against lower risk.

Data retention is the practice of defining how long an organization keeps data before it archives, anonymizes, or permanently deletes it. A retention policy gives each data category (system logs, personal data, financial records, backups) a set retention period — based on law, industry regulation, and operational need — and once that period is up, the data is deleted automatically.

In practice it means balancing two opposing goals: keep data long enough to meet evidentiary, audit, and investigative obligations, but no longer than necessary (the data minimization principle). Every dataset you no longer need is added risk — more to steal and more to expose in a breach.

What is a data retention policy?

A data retention policy is a written set of rules that answers four questions: what data is kept, how long, where and in what form, and who is responsible for its lifecycle and disposal. A typical policy includes:

  • Data classification by type, sensitivity, and business value, with a distinct retention period per category.
  • Retention periods tied to a legal or regulatory basis (e.g., 7 years for financial records, 6 years for HIPAA documentation).
  • Disposal methods — automated deletion, overwriting, anonymization, or secure media destruction at end of life.
  • Roles and responsibilities — typically IT, legal, compliance, and business process owners.
  • Archiving, backup, and access rules for data throughout the time it is kept.

Why does data retention matter for security?

Retention is not only about complying with the rules. For security it plays two important, partly conflicting roles:

  • Lower risk. Data you no longer keep can’t be stolen or encrypted in a ransomware attack. Deleting unnecessary datasets limits breach impact and the scope of what you later have to report.
  • Evidence for detection and forensics. Logs and network data must live long enough to detect and investigate an incident. An attacker can sit in the network undetected for weeks or months (the so-called dwell time), so logs shorter than that are no longer usable for after-the-fact analysis.

This tension — delete more vs. be able to trace an attack — is at the heart of retention in cybersecurity. User personal data is deleted quickly; security logs (logins, admin access, EDR events, NetFlow/IPFIX flow records) are usually kept longer, citing a legitimate security interest.

How long must data be kept? Regulatory requirements

There is no single universal period. The most frequently cited requirements:

  • PCI DSS (Requirement 10.7, v4.0): at least 12 months of audit log history, with a minimum of 3 months immediately available for analysis without restoring from backup.
  • HIPAA (45 CFR 164.316): security documentation, including logs and risk analyses, for 6 years from creation or last effective date.
  • GDPR (Article 5(1)(e)): no fixed period — personal data may be kept “no longer than is necessary” for the processing purpose (storage limitation principle). Security logs may live longer where justified by security monitoring and incident response.
  • SOX (Sarbanes-Oxley): 7 years for financial control records and related logs.
  • ISO/IEC 27001: sets no hard period but requires a defined, enforced log-retention policy (≥12 months is a common baseline).
  • NIS2: the EU directive states no single figure but mandates logging, detection, incident handling, and reporting (initial notification within 24 hours) — which in practice forces log retention long enough to investigate and document events.

When an organization falls under several regulations at once, it doesn’t write separate policies — for a given data category it applies the strictest requirement as the common denominator.

How to design a data retention policy?

  1. Inventory and classification — work out what data you collect, where it lives, and how sensitive it is.
  2. Requirement mapping — assign each category its legal/regulatory basis and the resulting minimum period.
  3. Setting the periods — reconcile regulatory minimums with minimization; for security logs, account for the time needed to detect and investigate an attack, not just compliance.
  4. Storage tiers — “hot” data (fast access for SIEM/NDR analysis) and “warm/cold” (cheaper archive). PCI DSS explicitly distinguishes 3 months hot and 12 months total.
  5. Automated disposal — deletion by rule, recording the deletion itself as an audit trail.
  6. Protection while data is kept — encryption, access control, and immutability (WORM/append-only) that shields logs from attacker tampering.

Log retention for SOC, NDR, and network monitoring

For security teams, retaining telemetry is a topic of its own. Logs and network flow metadata (NetFlow, sFlow, IPFIX), plus firewall, DNS, proxy, EDR, and identity events, are the raw material for detection and forensics. Key principles:

  • Immutability and integrity. Logs should be written so they can’t be silently deleted — clearing tracks is one of an attacker’s first moves. Centralization and append-only storage (add-only, no overwrites) help.
  • Cost grows with time. Full packet capture is kept briefly (days), flow metadata longer (months), and selected audit logs for years — because cost rises quickly with volume and duration.
  • Aligning with dwell time. If retention is shorter than the time an attacker went undetected, after-the-fact investigation is impossible — a common gap when the period is set purely to the minimum compliance requirement.
  • Correlation over time. Detecting slow exfiltration, C2 beaconing, or account abuse needs months of data, not days.

Learn more