Troubleshooting
Why Telegraf UDP outputs all land in the udp.autogen database
Short answer
With a udp:// URL the InfluxDB 1.8 UDP listener, not the Telegraf output block, chooses the database, so both outputs land in udp.autogen whatever their database lines say. Point both outputs at http://127.0.0.1:8086 with a namedrop filter toward telegraf and a namepass filter toward test, and each block's database setting is finally honored.

On this page
Both output blocks can carry different database values and still write to the same place, because with udp://localhost:8089 the destination is chosen by the InfluxDB 1.8 UDP listener, not by Telegraf. Line protocol sent over UDP carries no database name, so the listener writes every datagram into the one database configured on the server side — on a stock install the database udp under its autogen retention policy, which is the udp.autogen you are seeing. The two successful-connection log lines only prove that two output instances started. The fix is to point both outputs at the HTTP endpoint http://127.0.0.1:8086, where each block's database setting is honored, and split the traffic with namepass and namedrop.
What the UDP listener decides #
The outputs.influxdb plugin writes to an InfluxDB 1.x server over either of two transports, HTTP or UDP. On UDP, Telegraf sends line-protocol datagrams to the server's UDP listener, and an ordinary line-protocol write carries no database field — the receiving listener supplies the destination from its own service configuration. Two output blocks pointing at the same listener therefore share one destination. Renaming databases, creating new ones, or editing retention policies on the server changes nothing here; that listener has exactly one place to put what it receives.
Your configuration has two independent network paths, and only the second one is wrong. Measurements arrive on the input side, where a socket listener parses them into Telegraf metrics:
[[inputs.socket_listener]]
service_address = "udp://:8094"
data_format = "influx"
The outputs then serialize the parsed metrics toward the database server, and that is the path to repair. Read the evidence the same way:
- Two
Successfully connected to outputs.influxdblines: two output instances initialized. Nothing is said about two databases receiving data. - No Telegraf error although the writes land wrong: expected. UDP has no application-level write response, so an accepted, refused or discarded datagram all look identical to Telegraf.
- Flipping
exclude_database_tagchanged nothing: expected. That option is tag handling on the metric, and a metric tag is a different control from the destination a UDP listener picks. - Different
databasevalues, same landing spot: expected. On this transport the setting is not read at all.
Read the server version before the outputs #
The server receiving today's writes is InfluxDB 1.8, so the block to configure is outputs.influxdb with database and an optional retention_policy. The outputs.influxdb_v2 block from the 2.x documentation — urls, token, organization, bucket — targets the InfluxDB 2 HTTP API and does nothing against a 1.8 server; that migration is a later step and does not change what you deploy today. On 1.8 over HTTP, points land in the database's default retention policy, autogen, unless retention_policy names one you created yourself, so leave it empty here. When the InfluxDB 2 move does happen and a v2 output stops delivering, Telegraf failed to send metrics to any configured server traces that error path.
Counting destinations: two outputs through one port 8089 listener #
Inputs, all taken from your configuration and startup log:
- Output blocks: 2, both
outputs.influxdb, carrying differentdatabasevalues (telegrafandtest). - Receiving UDP listeners: 1, the InfluxDB 1.8 service, with one database setting of its own.
- Socket listener inputs: 1, on UDP port 8094 — excluded from this count, because that path works.
The rule in words: over UDP, the number of distinct write destinations equals the number of listeners times the databases each listener is configured for, and the output blocks contribute nothing. Over HTTP, each output block carries its own database with every write, so destinations equal the number of blocks with distinct database values.
Arithmetic before the change: 1 listener × 1 configured database = 1 destination, and 2 output blocks × 0 destination control per block = 0 per-output destinations. Every point from both blocks lands in that single destination, udp.autogen.
Arithmetic after the change: 2 output blocks × 1 database each = 2 destinations, telegraf and test.
Result: 1 destination before, 2 after. Decision: you need 2 distinct destination databases and the server has 1 UDP listener, so UDP outputs cannot deliver the split — the outputs move to HTTP. The threshold is one destination per listener; anything above it is an HTTP job.
Switch both outputs to the HTTP write endpoint #
- Save the active configuration and list every loaded output block, including fragments pulled in from a configuration directory — a forgotten third block keeps feeding the old destination.
- Confirm both destination databases exist on the 1.8 server and that the HTTP endpoint answers from the machine running Telegraf.
- Replace the UDP URLs with the HTTP endpoint, one database and one filter per block:
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "telegraf"
namedrop = ["Test*"]
username = ""
password = ""
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "test"
namepass = ["Test*"]
username = ""
password = ""
- Remove or disable the old UDP output instances so nothing continues writing to the listener's default database.
- Restart Telegraf through the normal service procedure and read the log for output write errors — over HTTP, failures finally report themselves.
Use plain double quotes and no whitespace inside the URL string; the working example you captured had spaces inside the quotes, which some parsers reject. 127.0.0.1 is the machine — or container — running Telegraf: if the database runs on another host, use its address, and if Telegraf itself is containerized, loopback points at the container, the trap covered in Telegraf MQTT connecting to localhost in Docker. The empty username and password strings are correct while HTTP authentication is off; once it is on, enter the deployment's writer account, confirm it can write to both databases, and give it write-only rights instead of reusing an admin login.
Make the two filters complementary #
namepass admits measurement names matching its patterns; namedrop drops them. Both filter on the measurement name only — never on tag values, field names, or which input produced the point. For the split you described:
| Output | Filter | Admits | Destination |
|---|---|---|---|
| 1 | namedrop = ["Test*"] |
every measurement name that does not match Test* |
telegraf |
| 2 | namepass = ["Test*"] |
every measurement name that matches Test* |
test |
Check one real matching name and one real non-matching name against the pattern's spelling and capitalization before moving on. Then delete duplicates: the working configuration you ended with held two identical blocks, both writing to test with the same namepass — that proves the HTTP switch worked, but it writes the matching metrics twice and leaves every other measurement unrouted, the duplicate-write behavior behind why Telegraf writes every metric to both InfluxDB databases.
With Telegraf's own measurements plus one socket listener, this complement is exactly the split you asked for. Know the boundary: a measurement from any other input whose name does not match Test* also lands in telegraf, so if you add inputs later whose names do not belong there, widen the patterns at that point.
Prove the split before you call it fixed #
- The input stays untouched:
service_addressanddata_formatremain as they are and points keep arriving and parsing, the receive side covered in configuring Telegraf socket_listener for PLC UDP to InfluxDB. - After the restart, the log shows successful HTTP writes and a freshly timestamped point is visible in each intended database. Require both: an attempted write in the log and a stored measurement.
- Count at the end: every measurement name sits in exactly one database. A name present in both means the filters overlap instead of complementing — fix the patterns, not the transport.
Questions asked
What does exclude_database_tag actually control?
It is tag handling, not routing: the option decides whether a database tag travels on the metric when it is written. On the UDP path the listener fixes the destination regardless of any tag, which is why flipping it changed nothing. Over HTTP the destination comes from the output block's database setting, so the option stays irrelevant to routing there too. Leave it at its default and fix the transport instead.
Why is the destination shown as udp.autogen rather than just udp?
InfluxDB 1.8 names a write destination as database plus retention policy, and autogen is the retention policy every database gets by default. A point written to the database named udp under that default policy is therefore displayed as udp.autogen. The dotted form is one destination, not two, and it is the default database of the UDP input service on a stock 1.8 install.
A measurement now appears in both databases. What is wrong?
The filters overlap instead of complementing: both output blocks admitted that name. Make exactly one block pass the pattern and the other drop it, with identical spelling and capitalization in both lists, and confirm no duplicate output block survived the edit. Once each name is admitted by one block only, the double appearance stops at the next write interval.
Does this change the plan to migrate to InfluxDB 2 later?
No. On the InfluxDB 2 server the output becomes outputs.influxdb_v2 with token, organization and bucket per block, and the same namepass and namedrop lists carry over unchanged. Each block's bucket is honored there because it travels with every HTTP write, the same reason the HTTP split works on 1.8. Do the 1.8 repair first so today's data lands correctly.


