How do you control Loki costs and performance at scale?
AdvancedProductionLog Pipelines
Answer
- Limit streams per tenant (
max_global_streams_per_user) and enforce label hygiene. - Per-tenant ingestion rate limits (
ingestion_rate_mb,ingestion_burst_size_mb). - Retention per stream via the compactor (
retention_enabled: true). - Query limits:
max_query_series,max_query_parallelism,split_queries_by_interval. - Bloom filters / structured metadata (Loki 3.x) for needle-in-haystack searches on high-cardinality fields.
- Caches for results and chunks; TSDB index (schema v13).
Watch loki_discarded_samples_total by reason to see what is being rejected.
More on Log Pipelines
What does a production log pipeline look like end to end?BeginnerWhy structured (JSON) logging, and what fields should every log line have?BeginnerFluent Bit, Vector, Grafana Alloy or the OpenTelemetry Collector: how do you choose a log agent?IntermediateWhy add an aggregation tier instead of sending directly from agents to the backend?IntermediateHow do you design log retention tiers?IntermediateHow do you scrub PII from logs in the pipeline?Intermediate