Send data to 2 elasticsearch indexes

i'm using logstash to send data from 2 different input:files and elastic search:
input {
elasticsearch{
hosts => "http://server_name:9200"
type => "host1"
}
file{
path => "/home/sana/pfe/docker/logs/**/*.log"
type => "host2" }}

now i want to put each data in diffrent index in my local elasticsearch using this method:
if "host1" in [type]{
elasticsearch{ hosts => ["localhost:9200"]
index => ["integrationlogs"] }
}
if "host2" in [type]{
elasticsearch{ hosts => ["localhost:9200"]
index => ["locallogs"] }
}

please what is the correct way to handle this

What you have should work.

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