I encounter some problems today on working for a parser, I created a custom parser for meet my customer needs and added some additional fields.
I've got this pattern:
Solved! Go to Solution.
Great question and one that took me a while to think about! So something to keep in mind, and I hope this is what you're describing as the issue, is right now you're saying you want the additional field to be an array, but right in your example you're setting it as a string: "public_ip_label.value.string_value" => "%{public_ip}"
Additional allows you to choose the data type, using the docs we link to from our UDM documentation: https://protobuf.dev/reference/protobuf/google.protobuf/
If you look at this you can see where we get "string_value" and what you're actually looking for is "list_value." I searched our parsers and see others using this so it's valid. If you want an example you can go look at the OCSF parser 🙂
-mike
Great question and one that took me a while to think about! So something to keep in mind, and I hope this is what you're describing as the issue, is right now you're saying you want the additional field to be an array, but right in your example you're setting it as a string: "public_ip_label.value.string_value" => "%{public_ip}"
Additional allows you to choose the data type, using the docs we link to from our UDM documentation: https://protobuf.dev/reference/protobuf/google.protobuf/
If you look at this you can see where we get "string_value" and what you're actually looking for is "list_value." I searched our parsers and see others using this so it's valid. If you want an example you can go look at the OCSF parser 🙂
-mike
Here is the code that worked for me:
filter {
json {
source => "message"
array_function => "split_columns"
}
mutate {
replace => {
"additional_field.key" => "hits"
"udm.metadata.event_type" => "GENERIC_EVENT"
}
}
for hit in hits {
mutate {
replace => {
"value.string_value" => "%{hit}"
}
}
mutate {
merge => {
"list_value.values" => "value"
}
}
mutate {
remove_field => ["value"]
}
}
mutate {
rename =>{
"list_value" => "additional_field.value.list_value"
}
}
mutate {
merge => {
"udm.additional.fields" => "additional_field"
}
}
mutate {
rename => {
"udm" => "event.idm.read_only_udm"
}
}
mutate {
merge => {
"@output" => "event"
}
}
}