In the Filebeat configuration, you can use document_typeto identify the various logs that you have. Then inside Logstash you can set the value of the field typeto control the target index.
, , type, . . index vs type.
Filebeat:
filebeat:
prospectors:
- paths:
- /var/log/redis/*.log
document_type: redis
- paths:
- /var/log/python/*.log
document_type: python
- paths:
- /var/log/mongodb/*.log
document_type: mongodb
Logstash:
input {
beats {
port => 5044
}
}
output {
if [@metadata][beat] == "filebeat" {
elasticsearch {
hosts => "localhost:9200"
manage_template => false
index => "%{[@metadata][type]}-%{+YYYY.MM.dd}"
document_type => "log"
}
}
}