Skip to content

Working with key_value logs when one of the keys does not have a value? #10552

Answered by spencergilbert
proffalken asked this question in Q&A
Discussion options

You must be logged in to vote

parse_key_value has accept_standalone_key defaulted to true, as well as whitespace to "lenient".

Playing in the REPL I get this:

$ parse_key_value!(.message, whitespace: "strict")
{ "DF": true, "DPT": "9100", "DST": "10.x.x.x", "ID": "62910", "IN": "eth1", "LEN": "60", "MAC": "fc:ff:da:47:af:13:b4:2e:99:19:12:00:00:00", "OUT": "", "PREC": "0x00", "PROTO": "TCP", "RES": "0x00", "SPT": "47468", "SRC": "10.x.x.x", "SYN": true, "TOS": "0x00", "TTL": "63", "URGP": "0", "WINDOW": "64240" }

$ parse_key_value!(.message, accept_standalone_key: false, whitespace: "strict")
{ "DF PROTO": "TCP", "DPT": "9100", "DST": "10.x.x.x", "ID": "62910", "IN": "eth1", "LEN": "60", "MAC": "fc:ff:da:47:af:13:b4:…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@proffalken
Comment options

@spencergilbert
Comment options

Answer selected by proffalken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants