How to use bucket_tag from input but not output bucket tag value

Hi, in my Telegraf config I’m using the bucket_tag to get the bucket name from the input, but it also includes the bucket tag in the output (pointless data, because it’s already in the bucket…). I tried using tagexclude in the output, but then it ignored the bucket tag completely and didn’t know where to write the data (404 error). Any ideas on how to remove redundant tags from the output when those tags are required to route data from the input?

In the example config below, I want to route data from the mqtt consumer input to the influxdb2 output for organization “test-customer-1” and bucket “somebucket” when an mqtt message with the topic “test/test-customer-1/somedata” is received. If I remove the tagexclude setting from the output everything works ok, but it stores the redundant bucket and org tags. How do I route data from mqtt consumer to organization “test-customer-1” and bucket “somebucket” without storing the tags “bucket” or “org”?

[[outputs.influxdb_v2]]
  urls = ["http://influxdb2"]
  token = "xxxx"
  organization = "test-customer-1"
  tagexclude = ["bucket","org"]
  bucket_tag = "bucket"
  [outputs.influxdb_v2.tagpass]
    org = ["test-customer-1"]

[[inputs.mqtt_consumer]]
  servers = ["tcp://host.docker.internal:1883"]
  topics = [
    "test/+/somedata"
  ]
  topic_tag = ""
  qos = 1
  max_undelivered_messages = 10000
  persistent_session = true
  client_id = "telegraf"
  data_format = "json_v2"
  [inputs.mqtt_consumer.tags]
    bucket = "somebucket"
  [[inputs.mqtt_consumer.topic_parsing]]
    topic = "+/+/+"
    tags = "_/org/_"
  ...

just add exclude_bucket_tag = true

Thanks @Giovanni_Luisotto, works perfectly!

This info is missing from the docs, I’ve submitted an issue here: Telegraf configuration docs missing reference to exclude_bucket_tag setting · Issue #3864 · influxdata/docs-v2 (github.com).

I suggest you use the GitHub docs when working with Telegraf.
Personally, I’ve never used the doc on the InfluxData website, but I’ve seen from community posts that it is often missing parts.