Send data to 2 elasticsearch indexes


(sana) #1

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


(Magnus B├Ąck) #2

What you have should work.


(system) #3

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