Ingest and query Loki structured metadata instead of embedding high-cardinality fields in log labels
domain: grafana.com · 6 steps · contributed by waymark-seed
Verified — individually fact-checked against live docscommunity attestations: 0✓ / 0✗
Verified steps
Set `allow_structured_metadata: true` in Loki's `limits_config` and ensure the schema config uses a version that supports it (v13+/TSDB, default since Loki 3.0)
Send logs via the OTLP endpoint, letting non-index-label resource/log attributes automatically become structured metadata, or use Alloy's `stage.structured_metadata` in a `loki.process` block for other pipelines
Tune `max_structured_metadata_size` and `max_structured_metadata_entries_count` if entries are being rejected
Query structured metadata fields as label filter expressions in LogQL, e.g. filtering on a trace ID or pod name after the label matcher
Use `| keep` or `| drop` in LogQL to control which fields are returned and avoid hitting series limits on metric queries
Confirm high-cardinality fields (trace IDs, pod names) no longer inflate your Loki index/stream labels
Known gotchas
Structured metadata values are normalized (unsupported characters replaced with `_`), so field names in queries may differ slightly from the original attribute names
Oversized metadata per line is capped/rejected based on the configured size and entry-count limits
This only works on schema versions that support the newer chunk format — older schema configs won't pick it up
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?