filter_parser: fix multiple parser registration
@@ -94,6 +94,8 @@ static int configure(struct filter_parser_ctx *ctx,
{
int ret;
char *tmp;
+ struct mk_list *head;
+ struct flb_config_prop *p;
ctx->key_name = NULL;
ctx->reserve_data = FLB_FALSE;
@@ -105,15 +107,20 @@ static int configure(struct filter_parser_ctx *ctx,
if (tmp) {
ctx->key_name = flb_strdup(tmp);
ctx->key_name_len = strlen(tmp);
- } else {
+ }
+ else {
flb_error("[filter_parser] \"key_name\" is missing\n");
return -1;
}
- /* Parsers */
- tmp = flb_filter_get_property("parser", f_ins);
- if (tmp) {
- ret = add_parser(tmp, ctx, config);
+ /* Read all Parsers */
+ mk_list_foreach(head, &f_ins->properties) {
+ p = mk_list_entry(head, struct flb_config_prop, _head);
+ if (strcasecmp("parser", p->key) != 0) {
+ continue;
+ }
+
+ ret = add_parser(p->val, ctx, config);
if (ret == -1) {
flb_error("[filter_parser] requested parser '%s' not found", tmp);
}
