Telefraf: from Kafka to InfluxDB

Hello,
I have a system with a Kafka broker and an InfluxDB instance running in containers.
So far I was using a python script to get the data from Kafka and insert it into InfluxDB, but looking at the docs I found out about the Kakfa Telegraf plugin.
How should I configure it for my use case?

[[inputs.kafka_consumer]]
  brokers = ["kafka:9092"]
  topics = ["cpu"]
  data_format = "influx"

[[outputs.influxdb]]
    urls = ["http://influxdb:8086"]
    database = "cpu"

and the I publish data to kafka in the format key -> value as cpu -> cpu,host=device1,region=it used=9.0.

I tried it but it’s not working? It’s the first time that I use Telegraf therefore I’m a little bit lost.
Thanks

It turns out I just needed to look at the documentation (very well written tbh) more carefully!
Here the final result:

[agent]
  debug = true
  omit_hostname = true

[[inputs.kafka_consumer]]
  brokers = ["kafka:9092"]
  topics = ["example"]
  consumer_group = "telegraf_metrics_consumers"
  data_format = "influx"
 
[[outputs.influxdb_v2]]
  urls = ["http://influxdb:8086"]
  token = "token"
  organization = "org"
  bucket = "bucket"
1 Like