diff --git a/plugins/filter_nest/nest.c b/plugins/filter_nest/nest.c index 2ace2137e81..51b3fbdfe18 100644 --- a/plugins/filter_nest/nest.c +++ b/plugins/filter_nest/nest.c @@ -146,6 +146,9 @@ static int configure(struct filter_nest_ctx *ctx, ctx->prefix = flb_strdup(kv->val); ctx->prefix_len = flb_sds_len(kv->val); ctx->remove_prefix = true; + } + else if (strcasecmp(kv->key, "suppress_warnings") == 0) { + continue; } else { flb_plg_error(ctx->ins, "Invalid configuration key '%s'", kv->key); return -1; @@ -385,9 +388,11 @@ static inline bool is_kv_to_lift(msgpack_object_kv * kv, } memcpy(tmp, key, klen); tmp[klen] = '\0'; - flb_plg_warn(ctx->ins, "Value of key '%s' is not a map. " - "Will not attempt to lift from here", - tmp); + if (ctx->suppress_warnings == false) { + flb_plg_warn(ctx->ins, "Value of key '%s' is not a map. " + "Will not attempt to lift from here", + tmp); + } flb_free(tmp); return false; } @@ -757,6 +762,11 @@ static struct flb_config_map config_map[] = { 0, FLB_FALSE, 0, "Remove prefix from affected keys if it matches this string" }, + { + FLB_CONFIG_MAP_BOOL, "suppress_warnings", "false", + 0, FLB_TRUE, offsetof(struct filter_nest_ctx, suppress_warnings), + "Suppress warnings about non-matching keys" + }, {0} }; diff --git a/plugins/filter_nest/nest.h b/plugins/filter_nest/nest.h index 678c79a836b..672f58e3c57 100644 --- a/plugins/filter_nest/nest.h +++ b/plugins/filter_nest/nest.h @@ -35,6 +35,7 @@ struct filter_nest_ctx int key_len; char *prefix; int prefix_len; + bool suppress_warnings; // nest struct mk_list wildcards; int wildcards_cnt;