# Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
  servers = ["tcp://127.0.0.1:1883"]
  topics = [
    "telegraf/host01/cpu",
    "telegraf/+/mem",
    "sensors/#",
  ]
  metric_buffer = 1024

  data_format = "xpath_json"
  xpath_native_types = true

  # Configuration matching the first (ENERGY) message
  [[inputs.mqtt_consumer.xpath]]
    metric_name = "/name"
    timestamp = "/timestamp"
    timestamp_format = "unix_ms"
    field_selection = "/fields/*"
    tag_selection = "/tags/*"