Get the Value of an array, in the output config


I have the corresponding config file :

input {
  elasticsearch {
    hosts => "localhost"
    index => "articles"
    add_field => { "[@metadata][kafka_topics]" => ["test1", "test2"] }
output {
  stdout { codec => rubydebug{
      metadata => true
    } }
  kafka {
    topic_ids => "%{[@metadata][kafka_topics]}"

I have changed the output plugin for kafka so now it is supporting arrays .
topic_ids => ["test1","test2"] works smoothly.
but when I try to access the value of the variable it is treated as a string no matter what I try.

Yes, I don't think there's a way around this. Logstash's configuration language is primitive.

Is there a way to split the string by ',' in the output config ?
else, can I do something to change how the "%{}" works?

I ended up splitting the array inside the kafka's output plugin.
thanks for the help.

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