Hello,
I collecting logs via TCP input and I want specific log to be in logstash index and also in monitoring index. But logs with "time" in [tags] are only in monitoring index, not logstash. Why?
My Logstash output config look like:
output {
if "time" in [tags] {
elasticsearch {
hosts => ["192.168.1.1:9200"]
index => "monitoring-%{+YYYY.ww}"
}
}
else if [appname] == "java" {
elasticsearch {
hosts => ["192.168.1.1:9200"]
index => "java-%{+YYYY.MM.dd}"
}
}
else if [appname] != "java" {
elasticsearch {
hosts => ["192.168.1.1:9200"]
index => "logstash-%{+YYYY.MM.dd}"
}
}
}
But logs with "time" in [tags] are only in monitoring index, not logstash. Why?
Because that's how if ... else conditionals work. If the first condition is true the event will be sent to the monitoring index and the other conditions won't be considered at all.
That's basically what I said, and it's obvious that describing such logical conditions with prose easily turns ambiguous.
I'm not sure what to do here. I could suggest something that satisfies what I think you want, but if you're not at all familiar with conditionals I don't know if that helps.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.