What are the most important Loki design rules for labels?
IntermediateProductionLog Pipelines
Answer
Loki indexes labels only, not content. Labels define streams; every unique label set is a stream. Keep labels low-cardinality and static: cluster, namespace, app, env, level. Never use user_id, trace_id, pod IP or request path as labels. Put high-cardinality fields in the log body or as structured metadata (Loki 3.x) and filter at query time with | json | trace_id="...". Too many streams cause tiny chunks, high memory and slow queries.
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