logstash-plugins / logstash-output-influxdb

Apache License 2.0
58 stars 79 forks source link

Tags #59

Open osek666 opened 7 years ago

osek666 commented 7 years ago

Hi!

I have a little problem with tags.

My config is:

output {
  stdout {}
  influxdb {
    host => "xxx.xxx.xxx.xxx"
    db => "xxx"
    measurement => "%{measurement}"
    time_precision => "u"
    allow_time_override => "true"
    use_event_fields_for_data_points => true
    exclude_fields => ["@timestamp", "@version", "sequence", "message", "type", "measurement"]
  }
}

My message to logstash is:

{
  "time" : 1492764732982811,
  "measurement": "measurementName",
  "tags": ["someTag"],
  "someTag": "valueOfSomeTag",
  "value": 372345
}

I would like to define in "tags" array, which of my fields are tags. Right now everything what is in "tags" array, will be saved to InfluxDb as tag with "true" value. I can try to prepare pull request for that. Is there any chance for approval?

PauloAugusto-Asos commented 7 years ago

Hi osek.

If I understood correctly, you want to specify which fields are "Tag" and which are "Field" InfluxDB «columns».

You can do that, like this:

        data_points => {
            "someColumn" => "%{someColumn}"
            "someColumn2" => "%{someColumn2}"
            "someColumn3" => "%{someColumn3}"
        }
        send_as_tags => [
            "someColumn2",
            "someColumn3"
        ]
osek666 commented 7 years ago

You understood correctly, but I want to do it dynamically. I use logstash to forward metrics to InfluxDb. I don't want to write logstash configuration for every metric I have. Every message should define own list of tags.

sashaaKr commented 4 years ago

@osek666 I have the same requirement, did you find any way to send dynamic tags?

osek666 commented 4 years ago

Yes. We are using Telegraf instead of Logstash.