hi there!
i use multiple grok match patterns in my logstash filter.
eg:
filter {
grok {
# grok1
break_on_match => true
match => { "message" => [ "^(?<log_timestamp>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{1,3}).?(?\d+)\s{0,}%{WORD:log_level}.?\s:\sV21.OneTwoThreeHelper\s:\sPageRequest\s{0,}::\s{0,}(?<session_id>\w+)\s{0,}.?.?(?[0-9a-zA-Z]{0,})(?.?)"]}
add_field => { "project_type" => "PROJ1" }
add_field => { "transaction_type" => "REQUEST" }
}
grok {
# grok2
break_on_match => true
match => { "message" => [ "(?<log_timestamp>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{1,3}).(?\d+).?%{WORD:log_level}.?\s:\sPageResponse\s{0,}::\s{0,}(?<session_id>\w+)\s{0,}::\s{0,}.?.?(?[0-9a-zA-Z]{0,})(?.?)"]}
add_field => { "project_type" => "PROJ2" }
add_field => { "transaction_type" => "RESPONSE" }
}
grok {
# grok3
break_on_match => true
match => { "message" => [ "(?<log_timestamp>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{1,3}).(?\d+).?%{WORD:log_level}.?\s:\sPage3\s{0,}::\s{0,}(?<session_id>\w+)\s{0,}::\s{0,}.?.?(?[0-9a-zA-Z]{0,})(?.*?)"]}
add_field => { "project_type" => "PROJ3" }
add_field => { "transaction_type" => "RESPONSE" }
}
grok {....}
grok {....}
grok {grok40}
}
- by using break_on_match => true, if log event match grok2, then exit grok2 or exit filter?
- i use 40 groks line, iām not sure about performance impact on using multiple grokking. may i know how to improve performance and how to prepare / manage the logstash performance?
if someone give advice those, appreciate