Telegraf Kafka Consumer Input Prompt
Configure inputs.kafka_consumer to ingest metrics/events from Kafka topics — consumer group balancing, offset handling, TLS/SASL auth, message parsing, and backpressure — so Telegraf becomes a reliable stream consumer, not a lag generator.
- Target user
- Data/platform engineers consuming Kafka streams into metrics with Telegraf
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior streaming/observability engineer who has run Telegraf as a Kafka consumer at scale and knows how offset and backpressure misconfiguration turns into lag storms and lost data. Help me configure `inputs.kafka_consumer`.
I will provide:
- Broker list, Kafka version, and the topic(s) to consume
- Auth (plaintext / TLS / SASL mechanism) and whether it's MSK/Confluent/self-hosted
- The message format on the topic and expected throughput
Deliver:
1. **Connection & auth** — `brokers`, `version`, TLS (`enable_tls`, ca/cert/key), and `sasl_mechanism` (PLAIN/SCRAM/OAUTHBEARER) with credentials from `${ENV}`/secretstore. Nothing inline.
2. **Consumer group** — `consumer_group`, `topics`/`topic_regexps`, `balance_strategy` (range/roundrobin/sticky), and `offset` (`oldest` vs `newest`) with the tradeoff for cold starts and reprocessing.
3. **Parsing** — the `data_format` matching the message payload (`influx`, `json_v2`, `avro`+schema registry, `prometheus`), with the field/tag mapping and any key handling (`msg_headers_as_tags`, message key as tag).
4. **Backpressure & delivery** — `max_undelivered_messages`, `max_message_len`, and how Telegraf's internal buffering plus the downstream output rate govern lag; how to avoid a rebalance storm when the consumer can't keep up.
5. **Scaling** — running N Telegraf consumers in the same group vs partition count; what determines parallelism and how to avoid idle consumers.
6. **Observability of the consumer itself** — surfacing lag/undelivered internal metrics so consumer health is alertable.
Output: (a) a commented `inputs.kafka_consumer` TOML block, (b) an offset/rebalance strategy note, (c) a throughput/parallelism sizing calc vs partitions, and (d) a validation plan against a test topic.
Bias toward: secret injection, sticky balancing, explicit offset strategy, and consumer-lag observability.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Choose and Design the Right Telegraf Input Plugin for a Source
Pick the best Telegraf input plugin for a given data source (an app, host, API, log, queue, or device) and produce a production-ready inputs configuration with the right tags, fields, interval, and parser — instead of guessing between exec, http, prometheus, and a native plugin.
-
Telegraf Docker Input Metrics Collection Prompt
Configure inputs.docker to collect per-container CPU, memory, network, and blkio metrics with the right label mapping, container filtering, and socket permissions — without drowning your TSDB in ephemeral-container cardinality.
-
Telegraf Exec & Execd Custom Input Prompt
Build custom metric collectors with inputs.exec (run a script per interval) and inputs.execd (long-running streaming process) — choosing the right one, picking a data_format, and handling stdout/stderr, exit codes, and timeouts safely.
-
Telegraf HTTP JSON Input Design Prompt
Poll REST/JSON HTTP endpoints with inputs.http and parse the response with json_v2 — mapping nested fields, arrays, and objects into well-tagged metrics with correct auth, timeouts, and failure handling.
More Telegraf prompts & error guides
Browse every Telegraf prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.