logstash-plugins / logstash-output-influxdb

Apache License 2.0
58 stars 77 forks source link

Conditional creating fields depends on filtering results. #6

Open evgygor opened 9 years ago

evgygor commented 9 years ago

I'm using the logstash for collecting sar metrics from the server and store its in influxdb. Metrics from different sources (CPU, Memory, Network) should be inserted to the different series in influxdb. Of course amount and names of fields in those series depends type of metric source.

This is my config file: https://github.com/evgygor/test/blob/master/logstash.conf

For each [type] of metrics I should configure separate influxdb output. In this example, I configured two types of metrics, but I'm planning to use it for SAR metrics, JMX metrics, csv from Jmeter metrics, that mean - I need configure the appropriate output for each of them (tens).

Questions:

  1. How can I elaborate desired configuration?
  2. I there any option to use conditions inside plugin. Example: ..... if [type]=="system.cpu" {

    data_points => {
                           "time" => "%{time}"
                           "user"    => "%{user}"
     }

    else { data_points => { "time" => "%{time}" "kbtotalmemory" => "%{kbtotalmemory}" "kbmemfree" => "%{kbmemfree}" "kbmemused" => "%{kbmemused}" } } ....

  3. Is there any flag to define to influxdb plugin to use by default fields names/data types from input?
  4. Is there any flag/ability to define default datatype?
  5. Is there any ability to set field name "time" reserved with datatype integer?

Thank a lot.