MQTT topic parsing: Pivoting doesn't work

I follow the example https://www.influxdata.com/blog/pivot-mqtt-plugin/ to rotate values from a vertical format into a horizontal format.

[[inputs.mqtt_consumer]]
  servers = ["tcp://mqtt.XXX:1883"]

  ## Username and password to connect MQTT serve
  username = "telegraf"
  password = "@{docker_secretstore:telegraf_mqtt_password}"
  data_format = "json"

  topics = [ 
    "warp/evse/state",
  ]

  [[inputs.mqtt_consumer.topic_parsing]]
   topic = "warp/+/+"
   measurement = "measurement/_/_"
   tags = "_/_/field"

[[processors.pivot]]
  tag_key = "field"
  value_key = "value"

The topic parsing works, but not the pivoting. Any idea why it doesn’t work?

Hello @alexander-zimmermann,
to pivot the data after ingest you’ll need to use flux for that:

Try adding this to the end of your query before a |>yield() statement

    |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")

I hope that helps!

Hey @Anaisdg,

thanks for your reply. To be honest, I’m not a DB expert and cannot judge what strategy is the best one. If I understand you correctly, you suggest to not pivot the data before ingesting, but afterward w/ flux, correct?