What is log retention, and how long should audit logs be kept? It is the written rule for how long each class of log stays searchable, sits in an archive and is deleted. No single law sets one number. PCI DSS v4.0.1 requirement 10.5.1 asks for at least 12 months, with the latest three months immediately available. US federal agencies under OMB memorandum M-21-31 keep most logs 12 months active plus 18 months cold. Elsewhere, keep each class as long as its purpose requires, then delete it by policy.
“Keep everything forever” raises cost and privacy risk without making the record more trustworthy. The record itself has to let a team answer five questions after a sensitive action: who acted, what they did, which object changed, when it happened and whether it succeeded. It also needs enough context to connect related events without copying passwords, access tokens or whole request bodies into a new store of sensitive data.
Published retention floors, rechecked December 4, 2026
| Rule set | Who it covers | What it says about log retention |
|---|---|---|
| PCI DSS v4.0.1, requirement 10.5.1 | Organizations that store, process or transmit payment card data | At least 12 months of audit log history; the most recent 3 months immediately available for analysis |
| OMB M-21-31 (August 27, 2021), Appendix C | US federal agencies | Most log categories: 12 months active plus 18 months cold storage; full packet capture: 72 hours; the periods are minimums |
| NARA General Records Schedule 3.2 | US federal agencies | Combines the memo’s 12 and 18 months into one 30-month retention; the memo alone gives no authority to dispose of records |
| HIPAA Security Rule, 45 CFR 164.312(b) | US covered entities and business associates | Requires audit controls that record and examine system activity, but names no log retention period |
| 45 CFR 164.316(b)(2)(i) | Same | Six years for the policies and documentation the rule requires, from creation or the date last in effect |
| GDPR Article 5(1)(e) | Personal data under EU law | No fixed period: identifiable data may be kept no longer than its purpose requires |
Two patterns stand out. The published floors split retention into a fast tier and a slower tier rather than one number. And the six-year HIPAA figure that often circulates as a “log retention rule” is, in the regulation’s text, a documentation rule; whether a given log counts as required documentation is a question for the covered entity’s own compliance analysis.
On December 4, 2026 the PCI wording above matched Microsoft’s requirement-by-requirement mapping, and NARA’s GRS 3.2 FAQ still gave the 30-month combined period; that page says it was last reviewed on January 22, 2025.
What the floors mean in storage
A hypothetical service that writes 2 GB of audit events a day shows the difference between the two shapes:
| Pattern | Searchable tier | Archive tier | Total held |
|---|---|---|---|
| PCI DSS 10.5.1 (3 months hot, 12 months total) | 90 days × 2 GB = 180 GB | 275 days × 2 GB = 550 GB | 730 GB |
| M-21-31 (12 months active, 18 months cold) | 365 days × 2 GB = 730 GB | 548 days × 2 GB ≈ 1.1 TB | ≈ 1.8 TB |
The volume is illustrative; the arithmetic is the point. Under the PCI shape only a quarter of the year has to stay instantly searchable, so the retention decision is as much about query speed as about disk space. Test that a three-month-old event can actually be found, not only that it exists in an archive.
The gap between a platform default and the floor
Many teams never set a retention period at all; they inherit whatever the platform keeps. Microsoft’s Entra data retention page, last updated on March 25, 2026 and read on December 4, 2026, lists audit logs and sign-in logs at seven days on Entra ID Free and 30 days on P1 and P2. Set that beside the 365 days that PCI DSS 10.5.1 asks for:
| Entra plan | Audit log default | Days short of 365 | What closes the gap |
|---|---|---|---|
| Free | 7 days | 358 | Export to storage or a log platform you control |
| P1 and P2 | 30 days | 335 | The same export, run continuously |
The days-short column is our arithmetic. The point is not that Entra is deficient: Microsoft’s own mapping tells readers to export the logs for long-term archival. The point is that a policy written as “one year” is false the moment the default is the only copy.
Start with the decision the log must support
The right event list comes from the system’s risks, not from a generic checklist. The OWASP Logging Cheat Sheet recommends defining security monitoring during requirements and design, with the level of detail proportionate to the risk.
For a typical product, the first audit events include:
- sign-in success, failure and account lockout;
- changes to roles, permissions and authentication methods;
- creation, update, deletion and export of important records;
- access to high-risk data or administrative tools;
- configuration, billing and integration changes;
- key, token and credential lifecycle actions;
- security-control failures and attempts to bypass validation;
- starts and stops of the logging system itself.
Operational, transaction and security logs can overlap, but their purposes differ. A payment ledger may need exact financial reconstruction. A security log needs to show suspicious access and control changes. Keeping them logically separate makes permissions, retention and investigations easier to manage.
What each audit event should contain
OWASP groups useful event data under “when, where, who and what.” In practice, an audit record often needs these fields:
| Field | What it should answer |
|---|---|
| Event time | When the system says the event happened, with timezone |
| Recorded time | When the collector received or stored it |
| Actor | Stable user, service or workload identifier |
| Authentication context | Session or credential type, without the secret itself |
| Action | The normalized operation attempted |
| Target | Resource type and stable identifier |
| Outcome | Success, failure, denial or partial completion |
| Reason | Safe error or policy reason |
| Origin | Service, host, tenant, region and source address where appropriate |
| Correlation ID | Which request, job or workflow the event belongs to |
| Change summary | Which fields changed, using redaction for sensitive values |
| Log schema version | Which event definition produced the record |
A display name is useful for people, but it should not replace a stable identifier. Names and email addresses change. The immutable ID is what lets an investigator follow one actor through a long timeline.
A correlation ID is equally important in distributed systems. It connects an API request to a queue job, database update and webhook delivery without pretending that one timestamp proves causation. The same identifier can also help analyze duplicate API operations and webhook replay protection.
Do not turn the log into a secrets archive
Logs are widely copied, indexed and shared during incidents. That makes careless logging a high-impact leak.
OWASP advises excluding or masking data such as passwords, access tokens, session identifiers, encryption keys, sensitive personal data and payment-card information. Request and response bodies deserve particular suspicion because they can contain all of those at once.
Safer patterns include:
- log the credential type and a non-secret key identifier, not the credential;
- log that a protected field changed, not its old and new values;
- store a truncated or keyed fingerprint only when matching is necessary;
- allowlist safe fields rather than trying to redact every dangerous field later;
- sanitize line breaks and delimiters so untrusted input cannot forge new log entries.
Error logs need the same discipline. A stack trace can help debugging, but it may contain file paths, query values or headers that do not belong in the main audit stream.
A log retention policy, written as a table
The NIST Guide to Computer Security Log Management (SP 800-92, September 13, 2006) treats retention as part of log-management policy. Its draft revision, SP 800-92 Rev. 1, was published as an initial public draft on October 11, 2023; the comment period closed on November 29, 2023, and on December 4, 2026 NIST’s page still listed only that draft, with no final version. The draft frames log management as generating, transmitting, storing, accessing and disposing of log data, so cite it as a draft. A workable policy separates fast, searchable access from cheaper archives and maps both to a purpose.
| Log class | Example purpose | Retention decision |
|---|---|---|
| Administrative changes | Investigate privilege abuse | Long enough to cover the investigation and review cycle |
| Authentication events | Detect account attacks | Long enough for baselines, alerts and incident discovery |
| Application diagnostics | Debug recent failures | Short operational window unless tied to an incident |
| Financial audit trail | Reconstruct transactions | Contractual, accounting and regulatory requirement |
| Security incident evidence | Support the case record | Preserved under incident and legal-hold procedures |
Here is one row of that table filled in with numbers, for a card-handling service that treats PCI DSS as its floor. The figures are an example, not a rule:
| Field of the policy | Administrative change events |
|---|---|
| Searchable tier | 90 days (the PCI 3-month window) |
| Archive tier | 275 more days, so 365 in total |
| Deletion trigger | Day 366, run by the retention service, logged as its own event |
| Exception | Legal hold or open incident: held until the case closes |
| Owner | Named role that approves exceptions |
Write the decision in units the storage system can enforce: days in the searchable tier, days or months in archive, and a deletion date. Record exceptions such as an active legal hold separately. Otherwise “retain for one year” becomes an aspiration that nobody can verify.
Retention also begins at different moments. A raw event may age from collection time, while an incident case may age from closure. Make that start point explicit, and check every source: an aggregator set to 12 months does not help if the application or database it reads from rolls over after 30 days.
Protect logs from the people and systems they describe
A log is weak evidence when the same administrator can perform an action and silently erase its record. PCI DSS states the expectation directly: requirement 10.3.2 says audit log files are protected to prevent modifications by individuals, and 10.3.3 asks for prompt backup to a central server or media that is difficult to modify, as quoted in this requirement-by-requirement mapping. Send high-value events to a separate collection system with tightly scoped write access. Application accounts should append records, not browse or delete them.
Useful controls include:
- encrypted transport to the collector;
- restrictive read roles and recorded access to the log store;
- append-only or immutable storage for high-risk events;
- integrity checks, signed batches or hash chains where the threat model warrants them;
- time synchronization and an explicit clock-confidence field when devices can drift;
- alerts when collection stops or event volume changes unexpectedly;
- tested export and restoration procedures.
Immutability is not the same as indefinite retention. A store can prevent alteration during the approved window and still delete records automatically when that window ends. For what a protected log can and cannot establish in a dispute, see what an audit log can prove.
Can audit logs be deleted?
Yes, but deletion should happen through policy, not ad hoc cleanup. The retention service can remove expired records while producing its own administrative event: which dataset, policy version, date range and volume were deleted, and who approved an exception. Copies in backups and replicas need the same schedule; our note on deletion across backups and replicas covers that part.
Individual users usually should not be able to erase audit events that describe their actions. Privacy requests also need careful handling. If an event is legally required or necessary for security, a team may need to retain it while limiting access or pseudonymizing fields. The correct answer depends on the applicable law and the stated purpose, not on a blanket technical rule. Support systems raise the same question for ticket history; see customer support data retention.
Test the log before an incident
Choose one sensitive workflow and reconstruct it from the stored events. Can you tell who changed the permission, what object changed, whether the attempt succeeded and which downstream job ran? Then test the failure cases: collector unavailable, clock wrong, malformed input, oversized event and redaction rule broken.
Also rotate credentials and disconnect integrations to confirm that the audit trail captures the lifecycle. Our guide to OAuth refresh-token revocation explains why “disconnect” may leave several credentials or sessions to account for.
Reporting & Sources
Checked November 5, 2026 and rechecked December 4, 2026:
- PCI Security Standards Council, PCI DSS v4.0.1 document library, requirements 10.3.2, 10.3.3 and 10.5.1; requirement text as reproduced by Microsoft Learn, including requirement 10.4.1.1 on automated review.
- Microsoft Learn, Data retention in Microsoft Entra, for the seven and 30 day defaults (page updated March 25, 2026).
- Office of Management and Budget, M-21-31, Improving the Federal Government’s Investigative and Remediation Capabilities Related to Cybersecurity Incidents, August 27, 2021, Appendix C.
- National Archives, FAQs about GRS 3.2, Information Systems Security Records.
- eCFR, 45 CFR 164.312 and 45 CFR 164.316.
- Regulation (EU) 2016/679 (GDPR), Articles 5(1)(e) and 7(1).
- NIST, SP 800-92, Guide to Computer Security Log Management, September 2006, and SP 800-92 Rev. 1 initial public draft, October 11, 2023.
- OWASP, Logging Cheat Sheet.
The storage and days-short figures are editorial arithmetic on a hypothetical service. First published October 11, 2026; updated November 5, 2026 with published retention floors, a storage calculation and new questions; updated December 4, 2026 with a platform-default gap table, a filled-in policy row, the NIST draft status and answers to “what is log retention” questions.





