How to write while loops inside Logstash Elasticsearch

Is there any way to write loops inside output of Logstash

For a certain message

"total:100 name:product 1"

I can parse total from this message and want to send 100 times to elasticsearch My code is just pseudocode, is there any way to implement this?

filter {
  grok {
    match => { "message" => "%{total:total} (?m)%{name:name}" }
  }
}
output {
    while count<=time do
      elasticsearch { 
          hosts => ["localhost:9200"]
          index => "data-test"
          user => "elastic"
          password => "changeme"
      }
    end
}

No you cannot implement a loop in the output section. If you want 100 copies of something you could use a ruby filter to add 100 copies of it to an array, then use a split filter to make each one a separate event.

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