Subscribe to the Non-Human & AI Identity Journal

Log Retention

Log retention is the policy for how long logs are kept before archival or deletion. The practical question is not storage alone, but whether the organisation can preserve evidence long enough for forensics, compliance, and legal hold requirements without expanding exposure unnecessarily.

Expanded Definition

Log retention is the policy and operational practice that determines how long event data, security telemetry, access records, and system logs are preserved before archival or deletion. In NHI environments, the term matters because logs often become the only durable record of API key use, service account activity, token exchange, and agent execution. A sound retention policy balances forensic value, regulatory retention duties, and storage minimisation, while also preserving chain-of-custody for evidence handling.

Definitions vary across vendors on whether retention includes warm storage, immutable archives, or only the active log store, so governance teams should state the retention class explicitly. For NHI programs, the policy should align with investigation timelines, incident response needs, and controls such as NIST Cybersecurity Framework 2.0, which emphasises durable security logging as part of operational resilience. It should also reflect the visibility and lifecycle realities documented by Ultimate Guide to NHIs.

The most common misapplication is treating log retention as a storage cost setting, which occurs when teams delete records before legal, investigative, or compliance windows have expired.

Examples and Use Cases

Implementing log retention rigorously often introduces storage and governance overhead, requiring organisations to weigh faster deletion and lower cost against stronger evidence preservation and breach reconstruction.

  • A cloud platform retains authentication and token-use logs for a fixed period so investigators can trace whether a service account accessed sensitive data after a suspected compromise.
  • An engineering organisation keeps CI/CD audit logs long enough to determine whether an API key was introduced into a pipeline, then archived for a longer legal-hold period if litigation is anticipated.
  • A security team preserves agent execution logs to show which autonomous action invoked a privileged tool, especially when an AI agent’s behaviour must be reconstructed after an incident.
  • A regulated business uses tiered retention: short active retention for routine operations, longer immutable retention for compliance evidence, and separate deletion rules for privacy minimisation.
  • An NHI review maps log coverage to the realities described in Ultimate Guide to NHIs, because weak visibility into service accounts makes short retention especially risky.

In practice, these decisions should be aligned with standards-oriented logging expectations in NIST Cybersecurity Framework 2.0 and translated into retention classes by data sensitivity, system criticality, and investigation horizon.

Why It Matters in NHI Security

Log retention is central to NHI security because service accounts, workloads, API keys, and agents often act faster and more frequently than human users, leaving incident responders dependent on machine-generated evidence. Without enough retention, organisations lose the ability to prove when a secret was used, which principal made the call, or whether lateral movement occurred through an automation path. With too much retention, they increase exposure, administrative burden, and the volume of sensitive operational data that must itself be protected.

That tension is especially important because NHIs are commonly overexposed and under-observed; Ultimate Guide to NHIs reports that only 5.7% of organisations have full visibility into their service accounts, which makes preserved logs a compensating source of truth. Poor retention also weakens compliance evidence for audits, breach notification, and legal holds, especially where access history must be reconstructed after the fact.

Organisations typically encounter the operational necessity of log retention only after an incident, at which point missing records make forensics, accountability, and containment decisions far harder to defend.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0 and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 DE.CM-8 Covers logging and monitoring needed to detect and analyze events over time.
OWASP Non-Human Identity Top 10 NHI-05 Log visibility and auditability are core to non-human identity governance.
NIST Zero Trust (SP 800-207) AU Zero trust depends on auditability and continuous verification through records.

Set retention long enough to support detection, investigation, and post-incident analysis.