Hi, Below is my logstash output config file, I am using too many if, else if conditional statements in the code. Is it possible to do a case statement like in ruby or something which will reduce the repetition.
output {
if [type] == "my-report" {
elasticsearch {
hosts => ["localhost:9200"]
user => "myid"
password => "mypassword"
index => "my-reports-%{+YYYY.MM.dd}"
}
} else if [type] =~ "beat." {
elasticsearch {
hosts => ["localhost:9200"]
user => "myid"
password => "mypassword"
index => "beat-%{+YYYY.MM.dd}"
}
} else if [type] =~ "kafka." {
elasticsearch {
hosts => ["localhost:9200"]
user => "myid"
password => "mypassword"
index => "kafka-%{+YYYY.MM.dd}"
}
} else {
elasticsearch {
hosts => ["localhost:9200"]
user => "logstash_internal"
password => "logstashpassword"
index => "logs-%{type}-%{+YYYY.MM.dd}"
}
}
}