Hi there,
I am trying to send multiple log files from filebeat tologstash to elasticsearch. In kibana, I would like each log file under a separate index. This is my logstash.conf file:
# Sample Logstash configuration for creating a simple
# Beats -> Logstash -> Elasticsearch pipeline.
input {
beats {
port => 5044
}
}
filter {
if[type] =="DispatcherApp"{
grok {
match => {"message" => "%{COMBINEDAPACHELOG}"}
}
} else if [type] == "IncidentAgent" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}else if [type] == "IMMService" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
sniffing => true
manage_template => false
index => "web-%{type}"
document_type => "log"
#index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
}
}
and filebeat.yml is-
filebeat.inputs:
-
paths:
- E:\DemoSetup\DispatcherApp\logs\dispatcher-scheduler.log
input_type: log
document_type: DispatcherApp
-
paths:
- E:\DemoSetup\Incident Agent\Logs\Trace.log
input_type: log
document_type: IncidentAgent
-input_type: log
paths:
- E:\DemoSetup\Logs\IMSService\log.txt
input_type: log
document_type: IMMService
#multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
#multiline.negate: true
#multiline.match: after
setup.template.name: "index-%{[beat.version]}"
setup.template.pattern: "index-%{[beat.version]}-*"
output:
logstash:
hosts: ["localhost:5044"]
#index: "index-%{[beat.version]}-%{[fields.type]:other}-%{+yyy.MM.dd}"
I just get a new index created called "web-%{type} and all three file logs are collected under it only. I think the type mentioned in filebeat.yml isnt being acknowledge in logstash file due to the if condition only taking message=> COMMONAPACHE!