I\'m using Grok & Logstash to send access logs from Nginx to Elastic search. I\'m giving Logstash all my access logs (with a wildcard, works well) and I would like to get th
Ok, found it. grok
breaks on match by default. So the first match being good, it skips the second one.
I solved it like that :
filter {
if [type] == "nginx_access" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
match => { "path" => "%{GREEDYDATA}/%{GREEDYDATA:app}.access.log" }
break_on_match => false
}
}
}
I found it more desirable to use 2 grok blocks if there will be unmatching lines in the log files.
filter {
if [type] == "nginx_access" {
grok {
match => { "path" => "%{GREEDYDATA}/%{GREEDYDATA:app}.access.log" }
}
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
}