Skip to content

Commit

Permalink
logfmt: don't omit last item if it does not have a value
Browse files Browse the repository at this point in the history
A line like `foo=bar baz` should be parsed to `{"foo"=>"bar", "baz"=>nil}`, but `baz` was silently omitted by returning early from the parser.

Signed-off-by: Dennis Kaarsemaker <[email protected]>
  • Loading branch information
seveas committed Oct 20, 2022
1 parent 7f4a1e9 commit 2851630
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/flb_parser_logfmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,14 @@ static int logfmt_parser(struct flb_parser *parser,
while ((c < end) && ident_byte[*c]) {
c++;
}
if (c == end) {
break;
}

key_len = c - key;
/* value */
value_len = 0;
value_str = FLB_FALSE;
value_escape = FLB_FALSE;

if (*c == '=') {
if (c < end && *c == '=') {
c++;
if (c < end) {
if (*c == '"') {
Expand Down

0 comments on commit 2851630

Please sign in to comment.