Skip to content

Commit

Permalink
processor_content_modifier: logs: do not fail if keys are not found
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <eduardo@calyptia.com>
  • Loading branch information
edsiper committed Jun 25, 2024
1 parent 30a04be commit d2e01ad
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/processor_content_modifier/cm_logs.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static int run_action_insert(struct content_modifier_ctx *ctx,
ret = cfl_kvlist_insert_string_s(kvlist, key, cfl_sds_len(key), value, cfl_sds_len(value),
CFL_FALSE);
if (ret != 0) {
printf("Failed to insert key: %s\n", key);
flb_plg_debug(ctx->ins, "[action: insert] failed to insert key: %s", key);
return -1;
}
return 0;
Expand Down Expand Up @@ -451,7 +451,10 @@ static int run_action_delete(struct content_modifier_ctx *ctx,
return 0;
}

return -1;
flb_plg_debug(ctx->ins, "[action: delete] key '%s' not found", key);

/* if the kvpair was not found, it's ok, we return zero */
return 0;
}

static int run_action_rename(struct content_modifier_ctx *ctx,
Expand All @@ -465,7 +468,8 @@ static int run_action_rename(struct content_modifier_ctx *ctx,
/* if the kv pair already exists, remove it from the list */
kvpair = cfl_object_kvpair_get(obj, key);
if (!kvpair) {
return -1;
flb_plg_debug(ctx->ins, "[action: rename] key '%s' not found", key);
return 0;
}

tmp = kvpair->key;
Expand Down

0 comments on commit d2e01ad

Please sign in to comment.