What one typically does is assign different types to different kind of logs (you can do that from Filebeat). Then you can use conditionals in your Logstash configuration to do different things with different types of logs.
https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html
Right, so I'm having a difficult time understanding the syntax that needs to be configured in the filebeat.yml file and my logstash config file "test3.conf".
Here is what I have in my filebeat.xml:
filebeat.prospectors:
- input_type: log <--This needs to be "log" if I change it to "tools-message" then filebeat doesn't start
paths:
- /var/log/*.log
fields: {log_type: tools-message}
Here is what I have in my "test3.conf" logstash config file:
input {
beats {
port => "5043"
}
}
filter {
if [ log_type = "tools-message" ] {
grok {
add_tag => [ "bazzinga_testtag" ]
}
mutate {
replace => { "%{type}" => "tools-message" }
}
}
}
output {
elasticsearch {
hosts => ["10.111.119.211:9200"]
index => "%{type}_index"
}
#stdout { codec => rubydebug }
}
This logstash config file does not create an index with name "tools-message". Instead it creates an index called "log_index". I want to able to have multiple different indices based on the type of log that logstash is parsing from filebeats.