Prompt
How do I keep logs for 90 days without blowing up storage costs?
Latest observation
To keep logs for 90 days without storage getting expensive, the trick is usually not to keep everything in the same hot, fast, expensive storage tier.
Best practices
1) Use log tiering
Keep recent logs in hot storage for fast search, then move older logs to cheaper tiers.
Typical pattern:
- 0–7 days: hot/searchable storage
- 7–30 days: warm/less expensive storage
- 30–90 days: cold/archive storage
This gives you retention without paying premium rates for all 90 days.
2) Reduce log volume
Lowering the amount of data you store often saves more than changing storage.
Ways to reduce volume:
- Log at appropriate levels: avoid excessive
DEBUGin production - Remove duplicate logs
- Avoid logging large payloads, stack traces repeatedly, or raw request bodies
- Sample noisy events
- Use structured logs with concise fields instead of verbose free-form text
3) Compress logs
If you store logs as files or objects, compress them:
- gzip/zstd can cut storage significantly
- Especially effective for text logs
4) Separate “searchable” from “compliance”
If you only need logs for audits or incident recovery:
- Keep full-resolution logs for a short period
- Keep summarized or indexed metadata for 90 days
- Archive the raw logs cheaply in object storage
5) Use lifecycle policies
If you’re using cloud storage, set automated retention/move rules:
- S3 lifecycle policies
- Azure Blob lifecycle management
- GCS lifecycle rules
Example flow:
- ingest to log platform or object storage
- after 14 days, move to infrequent access
- after 30 days, move to archive
- expire after 90 days
6) Partition by time
Store logs by date/hour so old data can be deleted or archived efficiently. This helps with:
- cheaper retention management
- faster cleanup
- easier tiering
7) Keep only what you need
Check whether all logs need 90-day retention:
- security/audit logs may need 90 days
- application debug logs may only need 7–14 days
- metrics may replace some log use cases
Practical storage approach
A cost-effective setup often looks like this:
- Primary log system: 7–14 days searchable
- Object storage archive: 90 days retention
- Compression + lifecycle policies
- Reduced verbosity in app logs
Rule of thumb
If cost is a concern, optimize in this order:
- Cut log volume
- Compress
- Tier storage
- Shorten searchable retention
- Archive the rest
If you want, I can help you design a specific 90-day retention architecture for AWS, Azure, GCP, or Kubernetes.