Prompt
How should I store logs so hot searches stay fast and old logs stay cheap?
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
A good pattern is tiered storage with time-based partitioning:
1) Keep recent logs in a fast “hot” store
Use something optimized for low-latency search on recent data, like:
- Elasticsearch / OpenSearch
- ClickHouse
- BigQuery-style warehouse for analytics
- A log database with indexed recent partitions
Store only the last N days/weeks here, depending on how often people search them.
2) Move older logs to cheap “cold” storage
Archive older logs into low-cost object storage like:
- Amazon S3
- Google Cloud Storage
- Azure Blob Storage
Use compressed formats such as:
- Parquet for analytics
- JSON.gz / NDJSON.gz for simple archival
- ZSTD compression if supported
This keeps storage cost low while preserving the data.
3) Partition by time
Structure logs by:
- day
- hour
- service
- environment
Example:
logs/2026/10/28/service-a/logs/2026/10/27/service-a/
This makes retention, deletion, and retrieval much easier.
4) Use an ILM / lifecycle policy
Automate the flow:
- 0–7 days: hot, fully indexed
- 7–30 days: warm, less replicated or less indexed
- 30+ days: cold archive
- after retention period: delete
Many systems support this directly:
- Elasticsearch Index Lifecycle Management
- S3 lifecycle rules
- ClickHouse TTL
5) Index only what people search
To keep hot searches fast:
- index key fields only
- avoid over-indexing high-cardinality fields unless necessary
- precompute common filters
- use schema designed around query patterns
Recommended architecture
- Ingest pipeline writes logs to hot store + archive
- Hot store serves searches for recent logs
- Object storage keeps full history cheaply
- Optional: query engine can “reach into” cold storage when needed
Simple rule of thumb
- If searched often: keep it hot
- If rarely searched: compress and archive
- If never searched after a period: delete it
If you want, I can suggest a concrete setup for your stack, like ELK, ClickHouse, or S3 + Athena.