diff --git a/plugins/filter_rewrite_tag/rewrite_tag.c b/plugins/filter_rewrite_tag/rewrite_tag.c index aff6953b6f6..df37fef5d81 100644 --- a/plugins/filter_rewrite_tag/rewrite_tag.c +++ b/plugins/filter_rewrite_tag/rewrite_tag.c @@ -323,6 +323,9 @@ static int process_record(const char *tag, int tag_len, msgpack_object map, mk_list_foreach(head, &ctx->rules) { rule = mk_list_entry(head, struct rewrite_rule, _head); + if (rule) { + *keep = rule->keep_record; + } ret = flb_ra_regex_match(rule->ra_key, map, rule->regex, &result); if (ret < 0) { /* no match */ rule = NULL; @@ -359,7 +362,7 @@ static int process_record(const char *tag, int tag_len, msgpack_object map, return FLB_FALSE; } - *keep = rule->keep_record; + return FLB_TRUE; }