For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

Export metrics to Elastic

This use case describes how to export PromQL metrics to Elasticsearch as ECS-compliant JSON documents, ready to be explored in Kibana alongside other ECS data sources.

Scenario

A platform operator wants to forward selected Mimir metrics to a centralized Elastic deployment. The Monitoring Exporter handles the full data path: PromQL range queries from Mimir, label normalization to ECSOpens in a new tab field names, OAuth 2.0 token refresh, and delivery of an NDJSON stream of ECS documents to an ingest gateway.

Prerequisites

A core/v1 Secret must exist in the same namespace as the Exporter CR, containing four keys:

To create the Secret:

bash

Configuration

Apply an Exporter CR in the same namespace:

yaml

ECS document shape

Each document sent to the gateway is ECS-compliant, with ECS fieldsets as nested objects at the document root. The documents are streamed as NDJSON (one document per line, no Elasticsearch _bulk action lines). For the smc_session_active_total metric with typical Kubernetes tags, a single document looks like:

json

The composition sends this through Telegraf's outputs.http plugin using the elasticcommonschema serializer, which expands the dotted tag keys produced by processors.rename (orchestrator.cluster.name, container.name, …) into nested objects at the root — no tag wrapper and no Elasticsearch-side ingest pipeline required. Tags without an ECS mapping (for example Prometheus job, instance) remain as top-level keys.

Field notes

  • spec.sink.elastic.auth.oauth2.secretRef.name — References the Secret created above. The Secret must be in the same namespace as the Exporter.
  • spec.sink.elastic.enableGzip — Enable gzip compression on requests (default: true). Set to false only for debugging or when the network path already compresses traffic.
  • spec.source.pollInterval — Controls how often Telegraf queries Mimir. Set it to match the Mimir scrape interval (usually 30s or 60s) to avoid sampling artifacts.
  • spec.source.metrics[].limit — Caps series returned per query tick. Without a limit, large queries may cause silent truncation in Mimir or spike Telegraf memory. Set to the expected series count plus roughly 20% headroom.