Tag data coming from particular inputs.socket_listener

How can I tag all data coming from particular (UDP) inputs.socket_listener? I have two sockets which receive data with identical structure and I want to distinguish them, for example redirecting to different buckets on InfluxDB 2.0.

I want to use this option in [[outputs.influxdb_v2]]: bucket_tag = ""

it’s as simple as the following example, which I stole from the examples docs

[[inputs.cpu]]
  percpu = false
  totalcpu = true
  [inputs.cpu.tags]
    tag1 = "foo"
    tag2 = "bar"

This will create 2 tags with the defined values.

You can create your tag (ie: destBucket), with different, static values and use them to route the data to a specific bucket.

1 Like

Hi Giovanni, thanks for your tip. I’m providing full example which I managed to get working based on it for future reference.

# # Configuration for sending metrics to InfluxDB
[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "LALA=="
  organization = "ORG"
  bucket_tag = "bucket4itz"
  exclude_bucket_tag = true

# # collectd
[[inputs.socket_listener]]
  service_address = "udp4://:25826"
  data_format = "collectd"
  content_encoding = "identity"
  ## Authentication file for cryptographic security levels
  collectd_auth_file = "/etc/collectd/passwd"
  ## One of none (default), sign, or encrypt
  collectd_security_level = "encrypt"
  ## Path of to TypesDB specifications
  collectd_typesdb = ["/usr/share/collectd/types.db"]
  collectd_parse_multivalue = "join"
  
  [inputs.socket_listener.tags]
    bucket4itz = "collectd"
1 Like