in_systemd: fix strip_underscores (adds extra character to value)
@@ -195,11 +195,12 @@ static int in_systemd_collect(struct flb_input_instance *i_ins,
while (sd_journal_enumerate_data(ctx->j, &data, &length) > 0 &&
entries < ctx->max_fields) {
key = (char *) data;
- sep = strchr(key, '=');
- len = (sep - key);
if (ctx->strip_underscores == FLB_TRUE && key[0] == '_') {
- key++; len--;
+ key++;
+ length--;
}
+ sep = strchr(key, '=');
+ len = (sep - key);
msgpack_pack_str(&mp_pck, len);
msgpack_pack_str_body(&mp_pck, key, len);
