I am creating a parser extension to append new values to the security_result.rules_labels that is already being used by the default parser. The following is the extension I created :
filter {
mutate {
replace => {
"security_result" => ""
"psp_security_result" => ""
}
}
json {
source => "message"
array_function => "split_columns"
on_error => "_not_json"
}
if [_not_json] {
drop {
tag => "TAG_MALFORMED_MESSAGE"
}
}
else {
mutate {
replace => {
"var_matched_field_value.value" =>
"%{jsonPayload.previewSecurityPolicy.matchedFieldValue}"
}
on_error => "no_matched_field_value"
}
if ![no_matched_field_value] and [var_matched_field_value][value] != "" {
mutate {
replace => {
"var_matched_field_value.key" => "matched_field_value"
}
}
mutate {
merge => {
"security_result.rule_labels" => "var_matched_field_value"
}
}
}
mutate {
convert => {
"jsonPayload.previewSecurityPolicy.matchedLength" => "string"
}
on_error => "already_a_string"
}
mutate {
replace => {
"var_matched_length.value" =>
"%{jsonPayload.previewSecurityPolicy.matchedLength}"
}
on_error => "no_matched_length"
}
if ![no_matched_length] and [var_matched_length][value] != "" {
mutate {
replace => {
"var_matched_length.key" => "matched_length"
}
}
mutate {
merge => {
"security_result.rule_labels" => "var_matched_length"
}
}
}
mutate {
convert => {
"jsonPayload.enforcedSecurityPolicy.matchedOffset" => "string"
}
on_error => "already_a_string"
}
mutate {
replace => {
"var_enforcedSecurityPolicy_matchedoffset.value" =>
"%{jsonPayload.enforcedSecurityPolicy.matchedOffset}"
}
on_error => "no_enforcedSecurityPolicy_matchedoffset"
}
if ![no_enforcedSecurityPolicy_matchedoffset] and
[var_enforcedSecurityPolicy_matchedoffset][value] != "" {
mutate {
replace => {
"var_enforcedSecurityPolicy_matchedoffset.key" =>
"enforcedSecurityPolicy_matchedoffset"
}
}
mutate {
merge => {
"psp_security_result.rule_labels" =>
"var_enforcedSecurityPolicy_matchedoffset"
}
}
}
mutate {
convert => {
"jsonPayload.enforcedSecurityPolicy.matchedFieldLength" => "string"
}
on_error => "already_a_string"
}
mutate {
replace => {
"var_enforcedSecurityPolicy_matchedfieldslength.value" =>
"%{jsonPayload.enforcedSecurityPolicy.matchedFieldLength}"
}
on_error => "no_enforcedSecurityPolicy_matchedfieldslength"
}
if ![no_enforcedSecurityPolicy_matchedfieldslength] and
[var_enforcedSecurityPolicy_matchedfieldslength][value] != "" {
mutate {
replace => {
"var_enforcedSecurityPolicy_matchedfieldslength.key" =>
"enforcedSecurityPolicy_matchedfieldslength"
}
}
mutate {
merge => {
"psp_security_result.rule_labels" =>
"var_enforcedSecurityPolicy_matchedfieldslength"
}
}
}
if [security_result] != "" {
mutate {
merge => {
"event.idm.read_only_udm.security_result" => "security_result"
}
}
}
if [psp_security_result] != "" {
mutate {
merge => {
"event.idm.read_only_udm.security_result" => "psp_security_result"
}
}
}
mutate {
merge => {
"@output" => "event"
}
}
}
}
The behaviour from this extension does not add values to security_result.rule_labels but overrides the values mapped by the default parser.
My question is, how can I change the behaviour in a way I don´t override the values provided by the default parser but instead I add values to the existing ones in security_result.rule_labels ?