Telegraf http_listener tag setup

Hi, I currently have multiple http_listeners set up in Telegraf, and each http_listener adds a different tag to the incoming data. I then have different tag_pass statements on multiple outputs. This allows me to redirect incoming data to different databases. For example:

[[inputs.http_listener]]
  service_address = ":8204"
  read_timeout = "10s"
  write_timeout = "10s"
  basic_username = "myUser"
  basic_password = "myPwd"
  [inputs.http_listener.tags]
    source = "sandbox_listener"    

[[outputs.influxdb]]
  urls = ["http://127.0.0.1:8086"]
  precision = "ms"
  timeout = "10s"
  database = "dbSandbox"
  username = "myDBUser"
  password = "myDBPwd"
  [outputs.influxdb.tagpass]
   source = ["sandbox_listener"]   

What I’ve realised though is if (in this case) there is a tag called ‘source’ already existing in the incoming data, it breaks down as the http_listener doesn’t rename the tag value. If the ‘source’ tag value is set to a valid entry that matches one of the tag_pass values that are used on the output, then it means the data will end up in the wrong database, even though it was sent with credentials which didn’t have write access to that database.

I could improve things by using a more obtuse tag name than ‘source’. However, is there a better way to address this issue please?

The issue came about because data had been sent to the database with the wrong value for another tag. We exported all the data into Python, modified the tag name and then tried to send it back to a different database by posting it to a different endpoint on the server (and therefore to a different http_listener) but it went to the wrong place.

Related to this

You will have to use an more obscure tag name, perhaps something like __input__.

We are planning to use source to denote the hostname of the server that produces the metrics, similar to how we use host for the hostname running Telegraf: https://github.com/influxdata/telegraf/issues/4413