There is no intermediary_nat field. Try:
"event.idm.read_only_udm.intermediary.ip" => "natip"
@Indrajeet_D
Here is how I would parse this value.
your code
Code I have written:
if [_collector_internal_ip_address] not in [ "","-" ] {
grok {
match => {
"_collector_internal_ip_address" => [ "%{IP:natip}" ]
}
overwrite => ["natip"]
on_error => "not_valid_natip"
}
}
if ![not_valid_natip] {
mutate {
merge => {
"event.idm.read_only_udm.intermediary_nat.ip" => "natip"
}
}
}
No need to check if _collector_internal_ip_address is blank or _ .
- The grok filter with IP match will handle the error handling.
- If the value is an IP and the on_error equal false it will map the IP to the correct UDM value.
The logic here if ![zerror][GROK_x_int_nat_ip] is checking if zerror.GROK_x_int_nat_ip is false. If so will merge the ip into x_intermediary.nat_ip.
To check if an on_error is true remove the ! . It will look like this if [zerror][GROK_x_int_nat_ip]
Intermediary is a repeated field, so you will also need to merge x_intermediary into intermediary.
my code
filter {
mutate {
replace => {
"x_intermediary" => ""
}
}
# Grok natip
grok {
match => {
"natip" => [
"%{IP:x_int_ip}"
]
}
overwrite => ["x_int_nat_ip"]
on_error => "zerror.GROK_x_int_ip"
}
if ![zerror][GROK_x_int_nat_ip] {
mutate {
merge => {
"x_intermediary.nat_ip" => "x_int_nat_ip"
}
}
}
if [x_intermediary] != "" {
mutate {
merge => {
"event.idm.read_only_udm.intermediary" => "x_intermediary"
}
on_error => "no_intermediary1"
}
}
#statedump{}
mutate {
merge => {
"@output" => "event"
}
}
}