Answer the question
In order to leave comments, you need to log in
Why is an extra index created in ElasticSearch?
Hello!
FileBeat has two inputs:
filebeat.inputs:
- type: log
enabled: true
paths:
- /home/ ... /storage/logs/laravel*.log
document_type: json
json.keys_under_root: true
fields:
log_type: laravel_log
- type: log
enabled: true
paths:
- /var/log/apache2/error.log
fields:
log_type: apache_log
input {
beats {
port => 5044
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "%{[fields][log_type]}-%{+YYYY.MM.dd}"
}
}
%{[fields][log_type]}-2020.01.28
Answer the question
In order to leave comments, you need to log in
Found out where this index comes from. Logstash writes its logstash-plain.log there.
Apparently because it does not have a log_type, the index is created with that name.
To improve the situation, it turned out like this:
output {
if [fields][log_type] {
elasticsearch {
hosts => ["localhost:9200"]
index => "%{[fields][log_type]}-%{+YYYY.MM.dd}"
}
} else {
elasticsearch {
hosts => ["localhost:9200"]
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question