Skip to content

Conversation

chengshiwen
Copy link

For the following configuration, the column name "%{field_key}" in coerce_values won't work, because column names in coerce_values do not support sprintf-formatting in version 5.0.5.

This pull request is supported.

input {
    stdin { }
}

filter {
    json {
        source => "message"
    }
    ruby {
        code => "event.set('epoch', (event.get('time') / 60.0).round * 60)"
    }
    mutate {
        add_field => {
            "field_key" => "%{instance}-%{metric}"
        }
    }
}

output {
    influxdb {
        host => "127.0.0.1"
        port => 8086
        db => "aiops_node"
        measurement => "node.%{host}"
        flush_size => 1000
        idle_flush_time => 5
        allow_time_override => true
        time_precision => "s"
        send_as_tags => []
        # exclude_fields => ["@timestamp", "@version", "sequence", "message", "type"]
        coerce_values => {
           "%{field_key}" => "float"
        }
        data_points => {
            "time" => "%{epoch}"
            "%{field_key}" => "%{value}"
        }
    }
}

@cla-checker-service
Copy link

cla-checker-service bot commented Apr 10, 2020

💚 CLA has been signed

@chengshiwen chengshiwen changed the title support sprintf-formatting of column names in coerce_values Support sprintf-formatting of column names in coerce_values Apr 10, 2020
@chengshiwen chengshiwen reopened this Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant