Data_points is mandatory, what is the syntaxe to pass fields to influxDB

Cannot find the syntax to get the fields passed to influxDB

my K8S message I got through Kafka input end like (of course each message has different values:
"fields":{"env":"caa-hors-prod","cluster_name":"hprd","client":"caa"}}

I have tried ::
data_points => {"field_env" => "%{[env]}"
"field_cluster_name" => "%{[cluster_name]}"
"field_client" => "%{[client]}"}
and
data_points => {"field_env" => "%{env}"
"field_cluster_name" => "%{cluster_name}"
"field_client" => "%{client}"}

and
data_points => {"field_env" => "%env"
"field_cluster_name" => "%cluster_name"
"field_client" => "%client"

In all case what I retrieve in InfluxDV , is the litteral field name, eg::
"%{[env]}" or "%{env}" or "%{env}"

when I am expecting in this case :: the value "caa-hors-prod"

How to say that I want to see the field "env" as column "env" in InfluxDB ???
or an other way how can I transfert all the input fields to InfluxDB output ???
I tried the line ::
data_points =>{}
but it yelds errors in Logstash::
[2020-03-04T17:58:09,314][WARN ][logstash.outputs.influxdb] Non recoverable exception while writing to InfluxDB {:exception=>#<InfluxDB::Error: {"error":"unable to parse 'K8S_E4 1583324018188': invalid field

A last one, with this ending JSON message:
"reference":{"env":"caa-hors-prod","cluster_name":"hprd","client":"caa"}}

the fields: "env", "cluster_name" and "client" are encapsulated in tag "reference"
how do you express this field "env" encapsulated in tag "reference" knowing that
they are other fields "env" encapsulated elsewhere in the JSON message ???

Somebody can help , please ?

In a sprintf reference you would use %{[reference][env]}

In your first example you appear to have [fields][env], not just [env].

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.