From e784379976d8a54bcaf00906d7eb1ac39bef0a9c Mon Sep 17 00:00:00 2001 From: Markus Meyer Date: Sun, 24 Sep 2023 12:48:55 +0200 Subject: [PATCH] use config key "add_label" in code of plugin --- plugins/filter_log_to_metrics/log_to_metrics.c | 4 ++-- tests/runtime/filter_log_to_metrics.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/filter_log_to_metrics/log_to_metrics.c b/plugins/filter_log_to_metrics/log_to_metrics.c index cb7f285d882..99b4034c142 100644 --- a/plugins/filter_log_to_metrics/log_to_metrics.c +++ b/plugins/filter_log_to_metrics/log_to_metrics.c @@ -268,10 +268,10 @@ static int set_labels(struct log_to_metrics_ctx *ctx, snprintf(label_keys[counter], MAX_LABEL_LENGTH - 1, "%s", kv->val); counter++; } - else if (strcasecmp(kv->key, "label") == 0) { + else if (strcasecmp(kv->key, "add_label") == 0) { split = flb_utils_split(kv->val, ' ', 1); if (mk_list_size(split) != 2) { - flb_plg_error(ctx->ins, "invalid label, expected name and key"); + flb_plg_error(ctx->ins, "invalid add_label, expected name and key"); flb_utils_split_free(split); return -1; } diff --git a/tests/runtime/filter_log_to_metrics.c b/tests/runtime/filter_log_to_metrics.c index b8c8dba1dc2..eb38af61ce4 100644 --- a/tests/runtime/filter_log_to_metrics.c +++ b/tests/runtime/filter_log_to_metrics.c @@ -669,7 +669,7 @@ void flb_test_log_to_metrics_label(void) "metric_name", "test", "metric_description", "Counts messages", "kubernetes_mode", "off", - "label", "pod_name $kubernetes['pod_name']", + "add_label", "pod_name $kubernetes['pod_name']", NULL); out_ffd = flb_output(ctx, (char *) "lib", (void *)&cb_data);