The gold-standard architectural pattern for combining aggressive cost control with long-term log retention is a tiered decoupled log pipeline.
Instead of streaming everything directly into an expensive indexed storage tier (like Datadog, Splunk, or standard Elasticsearch), you decouple collection, filtering, hot/warm search , and cold/archive storage.
Cost Control Action: Do your heavy lifting at the edge . Drop health-check logs, debug noise, and static access logs (200 OK) before they ever cross the network. Sample high-frequency verbose application logs (e.g., keep 5% of repetitive INFO traces, 100% of WARN/ERROR).
The Routing/Transformation Layer: Vector
Why: Acts as a central aggregator. It can buffer data, parse unstructured text into structured JSON, mask PII (emails, API keys, credit cards) to comply with data privacy, and route logs to multiple destinations based on priority.
The Hot/Warm Tier (Active Search - 7 to 30 days): ClickHouse or Grafana Loki
Grafana Loki: Highly cost-effective for Kubernetes because it indexes only metadata/labels, not full text.
ClickHouse: Emerging as an analytics powerhouse for logs. Columnar storage means blazing-fast SQL queries over massive datasets at a fraction of Elasticsearch's RAM/storage footprint.
The Cold/Archive Tier (Long Retention - 1 to 7+ years): Object Storage (AWS S3 / GCS / MinIO)
Why: Pennies per gigabyte.
Cost Control Action: Vector/Fluent Bit batches and compresses logs (using Zstandard/gzip) into parquet or compressed JSON files and flushes them straight to S3 bucket storage every 10–15 minutes.
The Query-on-Demand Layer (For Cold Data): DuckDB, Trino, or ClickHouse S3 Tables
Why: If you need to search logs that are 6 months old, you don't keep them hot. You query them directly out of S3 using serverless query engines or external tables, avoiding expensive always-on index clusters.
Tail-based vs. Head-based Sampling: Drop or rate-limit noisy low-value logs dynamically based on content rules in Vector.
Tiered Indexing: Full text index only for ERROR and WARN logs; metrics/labels index for INFO; zero index (raw object storage only) for audit/debug spam.
Lifecycle Policies on Object Storage: Transition raw archives from S3 Standard to S3 Infrequent Access (IA) or Glacier Instant Retrieval after 30 days, and Glacier Deep Archive after 90 days to slash storage bills by up to 90%.
To help tailor this specifically to your environment, tell me:
What is your approximate daily log volume (GB/TB per day)?
What is your current infrastructure or cloud provider (AWS, GCP, Kubernetes, VMs)?
What is your target retention period for searchable logs vs. deep archive?
Best log pipeline for cost control + long retention
My recommendation: OpenTelemetry Collector → filtering/routing pipeline → low-cost object storage (S3) + a searchable log backend.
The key is to separate logs you need to search immediately from logs you need to retain for months or years. Keeping every log fully indexed in a premium observability platform is often unnecessarily expensive. ClickHouse's published logging architecture and Grafana Loki's object-storage model are two strong approaches to evaluate.
Best options to shortlist
1. Grafana Loki + S3-compatible storage
(Best for low storage cost)
Ideal for Kubernetes, infrastructure logs, and teams already using Grafana. Loki indexes labels rather than every word in each log line, helping reduce indexing overhead. Keep recent logs searchable and use object storage for retention.
Trade-off: less suitable when you need powerful arbitrary full-text searches across all logs.
2. ClickHouse / ClickStack
(Best for analytics at scale)
Strong for high-volume application logs, SQL queries, aggregations, and retaining substantial datasets without indexing every field as a traditional search engine would. Pair it with object storage and appropriate data-retention policies.
Trade-off: self-hosting requires engineering expertise; query performance depends on schema, partitioning, and workload.
3. Grafana Cloud Logs
Best when you want Loki's approach without operating the infrastructure yourself. Grafana's published Pro pricing separates processing, writing, and retention charges, so model all three before committing.
Trade-off: managed convenience costs more than raw object storage alone.
Best if you're already invested in Datadog and need governance, redaction, filtering, and routing. Send high-value operational logs to Datadog while archiving lower-priority or long-retention logs elsewhere.
Trade-off: pipeline licensing and downstream search costs need to be included in the total cost.
Choose destinations by severity, service, and compliance needs
Hot / warm logs
Loki or ClickHouse
Fast operational searches for 7–30 days, or as required
Long-term archive
S3 / compatible storage
90 days to multiple years, with lifecycle policies
Cost-control priorities
Filter before ingestion. Remove noisy health checks, redundant debug messages, and unnecessary duplicate events.
Avoid indexing everything. Index only what your common investigations require.
Use tiered retention. Keep recent logs readily searchable and archive older data cheaply.
Preserve important events. Do not indiscriminately sample security audits, errors, or compliance-required records.
Budget for retrieval. Deep archives may incur restore fees and slower access; object storage is not automatically searchable through your usual log UI.