put worker log to ELK

This commit is contained in:
aynsix
2020-04-24 20:27:11 +03:00
parent fa25b39da8
commit 30fa50f48d
4 changed files with 71 additions and 0 deletions

36
config/logstash.conf Normal file
View File

@@ -0,0 +1,36 @@
input {
beats {
port => 5044
}
}
filter {
clone {
clones => ["to_stdout"]
}
if [type] == "to_stdout" {
#display only message field in the logstash stdout
prune {
whitelist_names => ["message"]
}
mutate {
add_field => { "[@metadata][type]" => "to_stdout" }
}
}
else {
mutate {
add_field => { "[@metadata][type]" => "to_elasticsearch" }
}
}
}
output {
if [@metadata][type][1] == "to_stdout" {
stdout {
codec => rubydebug
}
}
else {
elasticsearch { hosts => ["elasticsearch:9200"] }
}
}