Multiple mqtt_consumer to multiple influx databases

Hello,
Can I’d like to have one telegraf instance gather information from different mqtt servers and put the data from one mqtt server to one database and data from another mqtt server in another database. But I’m not sure how to do that. There is a [outputs.influxdb] plugin that seems to just define which database all the inputs use. And there doesn’t seem to specify (in the inputs.mqtt_consumer) which output plugin to use? So my configuration below would just write both mqtt_consumers to the same database.

# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
  urls = ["http://localhost:8086"] # required
  database = "telegraf_metrics_01"
  retention_policy = ""
  write_consistency = "any"
  timeout = "37s"
  username = "telegraf"
  password = "mypasswordhere"
  user_agent = "telegraf"


########################################################################

[[inputs.mqtt_consumer]]

  servers = ["tcp://192.168.1.2:1883"]
  qos = 2
  topics = [
    "/+/metrics1/#"
  ]
  persistent_session = false
  client_id = ""
  username = "telegraf" password = "metricsmetricsmetricsmetrics"
  data_format = "value"

########################################################################

[[inputs.mqtt_consumer]]

  servers = ["tcp://192.168.1.3:1883"]
  qos = 2
  topics = [
    "/+/metrics2/#"
  ]
  persistent_session = false
  client_id = ""
  username = "telegraf" password = "metricsmetricsmetricsmetrics"
  data_format = "value"

########################################################################

Hi @jason2 , welcome to the community ,
this should work for you , best regards

Configuration for sending metrics to InfluxDB

[[outputs.influxdb]]
urls = [“http://localhost:8086”] # required
database = "telegraf_metrics_01"
retention_policy = “”
write_consistency = “any”
timeout = “37s”
username = “telegraf”
password = “mypasswordhere”
user_agent = “telegraf”
tagexclude = [“destinationdb”]
outputs.influxdb.tagpass]
destinationdb = [“db01”]

[[outputs.influxdb]]
urls = [“http://localhost:8086”] # required
database = "telegraf_metrics_02"
retention_policy = “”
write_consistency = “any”
timeout = “37s”
username = “telegraf”
password = “mypasswordhere”
user_agent = “telegraf”
tagexclude = [“destinationdb”]
outputs.influxdb.tagpass]
destinationdb = [“db02”]

########################################################################

[[inputs.mqtt_consumer]]

servers = [“tcp://192.168.1.2:1883”]
qos = 2
topics = [
“/+/metrics1/#”
]
persistent_session = false
client_id = “”
username = “telegraf” password = “metricsmetricsmetricsmetrics”
data_format = “value”
telegraf_metrics_02
[inputs.mqtt_consumer.tags]
destinationdb = "db01"
########################################################################

[[inputs.mqtt_consumer]]

servers = [“tcp://192.168.1.3:1883”]
qos = 2
topics = [
“/+/metrics2/#”
]
persistent_session = false
client_id = “”
username = “telegraf” password = “metricsmetricsmetricsmetrics”
data_format = “value”
[inputs.mqtt_consumer.tags]
destinationdb = "db02"