CLOUD CONCEPT

Log Retention

Log retention is the policy and practice of keeping log records available for a defined period before securely deleting them.

Cloud Concepts Hub →

What is Log Retention

Log retention determines how long operational, security, and audit records remain available for monitoring, investigation, and compliance. An effective policy balances required history and retrieval speed against storage cost, privacy obligations, and protection from unauthorized alteration or deletion.

Log retention defines how long log records must remain available and under what conditions they can be deleted. It is separate from log collection: enabling a log source does not guarantee that its records will be stored for the required duration. A complete design specifies the sources, collection scope, storage destinations, retention periods, retrieval expectations, and controls that preserve the records.

Start with workload and security requirements rather than choosing one duration for every log. Administrative API activity, authentication events, network flows, application errors, database audit events, and web access logs answer different investigative questions. Determine which events are needed to detect threats, reconstruct an incident, satisfy contractual obligations, or troubleshoot failures. Confirm whether each source must be explicitly enabled, whether collection covers all relevant accounts and Regions, and whether filtering or sampling could remove required evidence.

Retention periods should reflect the time between an event occurring and someone needing to investigate it. A workload with delayed fraud discovery may need substantially more history than a short-lived development environment. Define both the total retention period and the period during which logs must be immediately searchable. For example, an organization might require 30 days of interactive investigation data and one year of durable archived records. These are example requirements, not universal compliance defaults.

Cloud implementations commonly separate a searchable store from a lower-cost archive. Recent logs support dashboards, alerting, and incident queries, while older records move to storage with lower ongoing costs. The trade-offs include indexing expense, query charges, archive minimum storage durations, retrieval charges, and restore delays. A storage class that requires hours to restore data is inappropriate when investigators must search the full retained history within minutes. Verify that the archive preserves the fields, timestamps, and context needed to reconstruct events.

Retention must work across the entire delivery path. Buffer expiration, failed delivery, missing permissions, or encryption-key problems can create gaps before data reaches its final destination. Monitor ingestion failures, unexpected drops in volume, and changes to retention settings. Test retrieval of older records and retain the necessary decryption keys for as long as the encrypted logs must remain readable. Check whether each system calculates expiration from event time, ingestion time, or object creation time; late-arriving records can otherwise receive less usable retention than intended.

Retention is not the same as immutability or backup. A configured expiration period does not necessarily prevent a privileged user from deleting records early. Where evidence preservation requires stronger protection, combine access separation with immutable storage or legal holds. In versioned object storage, lifecycle rules must also address noncurrent versions when actual removal is required. Legal holds may suspend normal expiration, while privacy requirements may limit unnecessary retention of personal information.

Do not assume that longer retention automatically improves monitoring. Alerts depend on timely ingestion, appropriate event coverage, and effective detection logic; archived records mainly extend retrospective analysis. Likewise, a service's built-in event history is not automatically a long-term archive. On AWS, CloudTrail event history provides the previous 90 days of management events in each Region; longer retention requires a separately configured destination or event data store with suitable retention settings.

Key aspects of Log Retention

Effective log retention combines complete collection, justified preservation periods, appropriate retrieval performance, deletion protection, and verifiable expiration.

Requirements-based retention periods

Set durations by log category using investigation needs, applicable obligations, and privacy constraints. Document both minimum preservation requirements and any required deletion deadlines.

Source coverage and delivery continuity

Identify the administrative, identity, network, application, and data-access events needed for each workload. Verify collection scope and monitor delivery failures so that a retention policy does not conceal missing evidence.

Searchable and archival retention

Separate the period requiring immediate queries from the total preservation period. Choose storage tiers according to investigation response times, retrieval costs, and restore delays.

Protection against premature deletion

Use least-privilege access, separation of duties, and immutable storage where required. Retention settings alone do not necessarily prevent administrators or compromised credentials from deleting logs.

Controlled expiration and exceptions

Automate expiration while accounting for replicas, exports, and noncurrent object versions. Apply approved legal holds when necessary and understand which timestamp starts each retention clock.

Operational validation

Monitor policy changes, ingestion gaps, and storage growth, and regularly test historical queries or restores. Preserve access to encryption keys and decoding information throughout the required retention period.

Cloud services for Log Retention

CloudTrail supplies AWS activity records, while CloudWatch Logs collects supported workload and platform logs for operational monitoring. S3 can hold a centralized archive with lifecycle rules and, where required, Object Lock protection. OpenSearch Service can provide an indexed investigation window, while Athena supports queries over accessible S3 log data without maintaining a separate search index. Coordinate retention independently across these stores: deleting an index need not delete the archive, and expiring archive objects does not remove exported copies. Validate delivery, encryption-key access, query performance, and restoration procedures against the required investigation timeline.

Amazon Simple Storage Service image Amazon S3

Amazon S3 provides durable storage for centralized log archives, with lifecycle rules for storage-class transitions and expiration. S3 Object Lock can protect object versions using retention periods or legal holds; lifecycle policies must also account for noncurrent versions when deletion is required.

Open Amazon S3 →
AWS CloudTrail image AWS CloudTrail

CloudTrail records AWS account activity, with trails delivering configured events to S3 for retention governed by the destination's policies. Its built-in event history covers 90 days of regional management events and does not replace a configured long-term archive or the explicit collection of required data events.

Open AWS CloudTrail →
Amazon OpenSearch Service image Amazon OpenSearch Service

OpenSearch Service supports indexed log analysis when engineers need interactive searches across retained events. Index State Management can automate index transitions and deletion, but indexed retention must be coordinated with any separate archive policy.

Open Amazon OpenSearch Service →
Amazon Athena image Amazon Athena

Athena queries logs stored in S3 without requiring a continuously running search cluster. It does not determine source-log retention; query availability depends on the underlying objects remaining accessible, including restoring archived objects when necessary.

Open Amazon Athena →