hi everyone!
is there anyway to check aws logstream name in logstash grok filter?
eg:
filter {
if "cloudwatch_logs.log_stream" == "TEST1" {
grok {
# type1
match => { "message" => [ "^(?<log_timestamp>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{1,3}).*?PROJ1(?<threadno>\d+).*%{WORD:log_level}.*?(?<session_id>\w+)\s{0,}:::\s{0,}RECEIVED\sDATA\s{0,}:"]}
add_field => { "project_type" => "PROJ1" }
add_field => { "transaction_type" => "TYPE1" }
}
grok {
# type2
match => { "message" => [ "^(?<log_timestamp>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{1,3}).*?(?<threadno>\d+).*%{WORD:log_level}.*?PROJ2\s+:\s+(?<session_id>\w+)\s{0,}:::\s{0,}\sRequest\s{0,}:"]}
add_field => { "project_type" => "PROJ2" }
add_field => { "transaction_type" => "TYPE2" }
}
}
else if [cloudwatch_logs.log_stream] == "TEST2" {
.....
}
else if [cloudwatch_logs.log_stream] == "TEST3" {
.....
}
}