We have beaver shipping logs to logstash. Two log sources are nginx error logs and haproxy logs. beaver is adding a tag for the log type and we'd like to parse the log according to type. We wrote the following configuration file but when logstash parses it we get the error: can't convert Array into String
(logstash -t -f logstash.conf
says the configuration is OK).
Any ideas how to fix this?
Here's logstash.conf
input {
udp {
port => 25826
buffer_size => 2048
codec => json
}
}
filter {
if "nginx-error" in [tags] {
grok {
match => {
# 2015/12/24 14:27:38 [error] 8#0: *43449 upstream timed ...
"message" => "%{DATESTAMP:timestamp} \[%{DATA}\] %{GREEDYDATA:message}"
}
overwrite => [ "message" ]
add_field => {
"levelname" => "ERROR"
"levelno" => 20
}
}
}
if "haproxy-log" in [tags] {
grok {
match => {
# [WARNING] 005/130716 (9) : Server app/app1 is ...
"message" => "\[%{DATA:levelname}\] %{GREEDYDATA:message}"
overwrite => [ "message" ]
add_field => {
"levelname" => "%{levelname}"
"orig_levelname" => "%{levelname}"
}
}
}
mutate {
gsub => [
# Change ALERT to ERROR for easy query
"levelname", "ALERT", "ERROR"
]
}
}
}
output {
stdout {
codec => rubydebug
}
}