Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for Telegraf Difficulty: Advanced ClaudeChatGPTCursor

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

More Telegraf prompts & error guides

Browse every Telegraf prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.