Workflow: Schema Exploration & Governance
Auditing label health and eliminating high-cardinality indexing mistakes in Grafana Loki.
Step 1: Global Taxonomy Inspection
List all indexed label names currently registered across the Loki cluster:
get_cluster_labels()
Confirm that only low-cardinality dimensions (e.g. environment, cluster, namespace, app, container) are indexed.
Step 2: Cardinality & Active Series Audit
Audit active streams to detect any high-cardinality values mistakenly indexed as stream labels:
get_active_series(match=['{cluster="prod-1"}'])
What the Tool Evaluates:
- Total Active Stream Count: Checks if stream volume is within healthy operational thresholds.
- Top Cardinality Labels: Highlights any label with high unique value counts (such as
user_id,trace_id, orclient_ipincorrectly passed as Promtail labels). - Remediation Recommendation: Advises moving dynamic attributes into structured metadata (
structured_metadatain Loki 3.0+) or log line bodies extracted via| jsonat query time.