Course contentsShow
← Cloud and Infrastructure
Lesson 2055 of 2,98943. Observability - LoggingFree lesson

Log Retention and Storage Classes

Configure retention policies, archival, and tiered storage for cost-effective log management.

Log Retention and Storage Classes

What you'll learn: How to configure retention policies, archival strategies, and tiered storage to reduce log management costs while maintaining compliance.

Why Storage Classes Matter

Logs are like old receipts—you need recent ones handy, but older ones can go in the basement. Not all logs require the same access speed or durability. A production error from today needs instant access, but last year's audit logs can live in cheaper, slower storage.

Cloud providers offer tiered storage classes that trade retrieval speed for cost savings:

  • Hot/Standard: Instant access, highest cost (today's logs)
  • Cool/Infrequent Access: Minutes to retrieve, medium cost (last 30-90 days)
  • Cold/Archive: Hours to retrieve, lowest cost (compliance/long-term)

Retention Policies in Practice

Most organizations implement lifecycle rules that automatically move logs between tiers:

  1. Days 1-7: Keep in hot storage for active debugging
  2. Days 8-90: Move to cool storage for recent investigations
  3. Days 91-365: Archive to cold storage for compliance
  4. Beyond retention: Delete permanently

In AWS CloudWatch, you might retain logs for 30 days in CloudWatch, then export to S3 Standard (30-90 days), transition to S3 Glacier (1-7 years), then delete. Azure Monitor offers similar workspace retention with export to Archive tier. Google Cloud Logging uses bucket retention combined with Cloud Storage lifecycle policies.

Cost vs. Compliance Balance

Consider regulatory requirements: financial services might need 7 years, while startups might keep 90 days. Compress logs before archiving—text compresses 80-90%. Use sampling for verbose logs while retaining all errors.

Key Takeaway: Tiered storage with automated lifecycle policies lets you keep logs as long as needed without breaking the budget—hot storage for active troubleshooting, cold storage for compliance, and automatic transitions in between.