Override UDP database config

Is it possible to override the database that the UDP client uses?

I’ve edited the influx.conf file and enabled UDP connections, however, when I specify the Database on the BatchPoints, any points written are still written to the default “udp” database.

Is this correct behavior, or is this not working as expected?

1 Like

You have to define multiple UDP endpoints in your influxdb config file, it’s a pain but it’s required. Each definition must have a unique port number (though the dbname could be the same if you wanted).

When writing UDP you don’t have to define the db endpoint in your line protocol.

[[udp]]
  enabled = true
  database = "db_one"
  bind-address = ":8089"
  batch-size = 10000
  batch-pending = 100
  batch-timeout = "11s"
  read-buffer = 16777216
  retention-policy = ""
  precision = ""
  udp-payload-size = 1600

[[udp]]
  enabled = true
  database = "db_two"
  bind-address = ":8090"
  batch-size = 10000
  batch-pending = 100
  batch-timeout = "11s"
  read-buffer = 16777216
  retention-policy = ""
  precision = ""
  udp-payload-size = 1600

[[udp]]
  enabled = true
  database = "db_three"
  bind-address = ":8091"
  batch-size = 10000
  batch-pending = 100
  batch-timeout = "11s"
  read-buffer = 16777216
  retention-policy = ""
  precision = ""
  udp-payload-size = 1600
1 Like

Any any databases that i’ll be using need to be defined in the config file or else they wont work?

Any database you want to enable for UDP entry, yes. If you’re using the UDP listener endpoints in influxdb then you’ll have to spin up a distinct port for the number of DBs you want to write to. When you write to that particular port, the udp_listener will leverage the DB you specified in the config.

On the contrary, if you want to use the default HTTP handler (aka TCP endpoint) you MUST provide the dbname for your writes.

1 Like

This worked for me. Now I can see that was very clear. Thanks a lot!