Telegraf ports with running multiple instances

Hey guys,

I’m using TCP to ship the various system metrics using a specific port. As I’m running multiple telegraf instances on a single server, I found there is a field ‘port’ shipped showing different values for each telegraf instance, which is 5-digit number like 539xx. Can I understand this is telegraf port number? Acutally I’m doing some performance test for the telegraf and wondering this way of running multiple instances would give me rough ideas about the performance. I don’t care about the data duplication and consider the CPU usage increase with many instances running on a single server.


@Ray_Chang Sorry, I don’t understand what your question is, can you explain a little more what you are trying to determine?

In short, telegraf looks like sending a field named ‘port’ in tags (or somewhere). What is this for? Is this used for each telegraf instance running on the server?

There aren’t any port tags that are sent on a global level, but there are some input plugins which have port tags. An example is the nginx input.

If you tell me which plugins you have enabled maybe we can figure out where it is coming from.

I tested that it’s not related to any input plugins I’m using. But I found it’s coming when I use tcp for socket_writer. If I use udp the port does not come. The ports I get from the telegraf instances are different from the one I specified in the tcp output plugin. Does this make sense?

I don’t see where in the code this would be added, can you isolate it to a minimal config and post it here?

I’m using logstash to receive the telgraf metrics. It looks like logstash sends the ‘port’ number as it communicates with the telegraf.



address = "tcp://"
data_format = “json”

Logstash conf

input {
tcp {
port => 2004
codec => json {}
filter {}
output {
stdout { codec => rubydebug }

This is an example event of output from logstash.

"@timestamp" => 2017-09-12T20:12:41.301Z,
“port” => 35914,
“name” => “mem”,
"@version" => “1”,
“host” => “”,
“fields” => {
“total” => 16657846272,
“inactive” => 1562255360,
“available_percent” => 79.62598635752376,
“cached” => 4842885120,
“available” => 13263974400,
“buffered” => 153481216,
“active” => 5500370944,
“used_percent” => 20.374013642476243,
“used” => 3393871872,
“free” => 8965939200
“tags” => {
“host” => “db0.local”
“timestamp” => 1505247161