Parsleaf

Google SecOps parser errors

non-string given for backstory.Noun.ip

You converted the IP with convert => ipaddress before merging it. That turns it into bytes; *.ip fields only take the plain string. Validate the IP with a pattern and merge the original value.

The error

failed to convert raw output to events: failed to convert raw message 0: field "idm": index 0: recursive rawDataToProto failed: field "read_only_udm": index 0: recursive rawDataToProto failed: field "principal": index 0: recursive rawDataToProto failed: panic encountered: non-string given for backstory.Noun.ip: []uint8 []byte{0xc6, 0x33, 0x64, 0xa2}

Why it happens

mutate { convert => { "src_ip" => "ipaddress" } } changes the field from text to a binary IP. The bytes in the message are the IP itself: 0xc6, 0x33, 0x64, 0xa2 is 198.51.100.162.

principal.ip, target.ip, principal.nat_ip and the other *.ip fields are repeated string fields, so merging the converted value fails when the event is built.

Validating with a capture-less grok such as grok { match => { "src_ip" => "^%{IP}$" } } is not a safe alternative: in SecOps it reports failure even for a valid IP, so the merge is silently skipped and the event has no IPs.

How to fix it

Fails:

mutate { convert => { "src_ip" => "ipaddress" } on_error => "src_ip_bad" }
if ![src_ip_bad] {
  mutate { merge => { "event.idm.read_only_udm.principal.ip" => "src_ip" } }
}

Works:

if [src_ip] =~ "^[0-9a-fA-F:.]+$" {
  mutate {
    merge => { "event.idm.read_only_udm.principal.ip" => "src_ip" }
    on_error => "src_ip_merge_failed"
  }
}

Where people usually hit it

principal.ip, target.ip, principal.nat_ip, principal.asset.ip, intermediary.ip

Still failing?

One error usually hides the next. Parsleaf writes the full parser from your sample logs and keeps fixing it from the errors your SecOps tenant returns, until it passes. Generate your parser: the first one is free.

Other parser errors