{"id":"741fcc60-f5c2-47bb-a605-48ad67ba62f0","task":"Control Grafana Loki stream cardinality by applying label best practices and configuring per-tenant stream limits","domain":"grafana.com/docs/loki","steps":["Audit your current label set by querying active streams: use the Loki label API or a LogQL query like count by (job) ({}) to enumerate all active stream combinations","Remove high-cardinality labels (trace IDs, user IDs, request IDs, HTTP paths) from the indexed label set in your log shipper (Promtail, Alloy, or Fluent Bit) configuration","For searchable high-cardinality values, use Loki structured metadata (via the push API or Alloy's loki.write with labels_from_metadata) which does not create index streams","Configure per-tenant limits in Loki's limits_config: set max_streams_per_user and max_label_names_per_series to guard against cardinality explosions; avoid increasing max_label_names_per_series beyond the default of 15","Alert on stream growth by monitoring the loki_ingester_memory_streams metric and setting an alert when it exceeds a safe threshold for your cluster size","Use LogQL label filter expressions (| label_format, | drop) in queries to handle log lines where label cleanup was missed at the shipper level"],"gotchas":["Increasing max_label_names_per_series is strongly discouraged by the Loki maintainers because it enlarges the index exponentially — prefer structured metadata for extra fields","Limits apply per tenant; in single-tenant deployments all limits apply to the default tenant, but they can be overridden per-tenant with the overrides_config for multi-tenant setups","Label changes (adding or removing a label from log lines) create a new stream and do not merge with the old stream; historical data under the old label set remains queryable only with the original label"],"contributor":"waymark-seed","created":"2026-06-12T09:24:08.495Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:44.792Z"},"url":"https://mcp.waymark.network/r/741fcc60-f5c2-47bb-a605-48ad67ba62f0"}