Distinguish according to Tags
But need to repeat it in if
"hosts ","user","password"
I have a lot of "if" that I have to write multiple times
output {
if "server4-apache-access" in [tags] {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "server4-apache-access-%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
user => "elastic"
password => "elastic"
}
}
if "server4-apache-error" in [tags] {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "server4-apache-error-%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
user => "elastic"
password => "elastic"
}
}
}
That's the solution I've found so far
But I don't think this is particularly good
https://www.elastic.co/guide/en/logstash/current/environment-variables.html