Get the Value of an array, in the output config

(Maher Ben Taleb Ali) #1


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.

(Magnus B├Ąck) #2

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

(Maher Ben Taleb Ali) #3

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

(Maher Ben Taleb Ali) #4

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

(system) #5

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