logstash-plugins / logstash-filter-kv

Apache License 2.0
17 stars 42 forks source link

handle empty values #58

Closed colinsurprenant closed 6 years ago

colinsurprenant commented 6 years ago

This fixes #57

Empty values, such as with a=1|b=|c=3 where not correctly handled and would be parsed as

{
       "message" => "a=1|b=|c=3",
             "a" => "1",
             "b" => "|c=3",
}

This PR fixes this by allowing empty values between the value separator and the field separator. I added specific specs for this case and all other specs are passing.

colinsurprenant commented 6 years ago

Thanks @andrewvc - will bump version and merge & publish.

colinsurprenant commented 6 years ago

published in version v4.1.1

LiuHarry1 commented 6 years ago

Hi colinsurprenant , I have below new issue which seems to be introduced by this fix, kv { field_split => "|" } Below message is log message type=[emc]|cause=[key is good]|flag=[P]|msg=[asdf ffff= ddd=] then it will convert to below json message: "cause": "key is good", "msg":[asdf" "ffff=":ddd=]"

Expected result is "msg":"[asdf\nffff=\nddd=]"

colinsurprenant commented 6 years ago

@LiuHarry1 version 4.1.2 was released since your comment - could you please rerun you test on the latest version and open a new issue if it is still a problem? Thanks.

colinsurprenant commented 6 years ago

Oh, nervermind, I just realized you created #63 - I'll followup over there.