I want to use different indices for "filebeat" and "metricbeat" input sources, shipping events to the logstash.
Here is the logstash.conf we are using.
input
{
beats
{
ssl => false
host => "0.0.0.0"
port => 5044
}
gelf
{
host => "0.0.0.0"
port => 12201
}
http
{
ssl => false
host => "0.0.0.0"
port => 8888
}
tcp
{
mode => "server"
host => "0.0.0.0"
port => 5010
}
udp
{
host => "0.0.0.0"
port => 5000
}
}
output
{
if [fields][beat] == "metricbeat" {
elasticsearch {
hosts => ["127.0.0.1:9200"]
document_id => "%{logstash_checksum}"
index => "%{[fields][beat]}-%{+YYYY.MM.dd}"
}
} else {
elasticsearch {
hosts => ["127.0.0.1:9200"]
document_id => "%{logstash_checksum}"
index => "logstash-%{+YYYY.MM.dd}"
}
}
}
The index is being created but only one event is inserted in the index.
The metricbeat configuration has a decicated field named beat.
fields:
beat: metricbeat
Here is the listing of all the indices.
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open logstash-2017.11.10 SCPT2qBJTsK1Hdgh3sOOCQ 5 1 8933 1 7.8mb 7.8mb
yellow open metricbeat-2017.11.10 RGWdtyJFS76bSfeA-lLAZg 5 1 1 55 87.4kb
I'm having a hard time routing the beat events in separate indices.
Please help me figure it out.