Skip to content

Commit

Permalink
out_http: don't retry non retryable 4xx status codes
Browse files Browse the repository at this point in the history
Fix a problem that http output plugin retries all requests that respond with an 4xx status code excepting 429 status code

Signed-off-by: Israel Zeromski <[email protected]>
  • Loading branch information
IsraelZeromski authored and edsiper committed Jul 8, 2024
1 parent a9a978c commit 4dfc256
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/out_http/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,15 @@ static int http_post(struct flb_out_http *ctx,
flb_plg_error(ctx->ins, "%s:%i, HTTP status=%i",
ctx->host, ctx->port, c->resp.status);
}
out_ret = FLB_RETRY;
if (c->resp.status >= 400 && c->resp.status < 500 && c->resp.status != 429) {
flb_plg_warn(ctx->ins, "could not flush records to %s:%i (http_do=%i), "
"chunk will not be retried",
ctx->host, ctx->port, ret);
out_ret = FLB_ERROR;
}
else {
out_ret = FLB_RETRY;
}
}
else {
if (ctx->log_response_payload &&
Expand Down

0 comments on commit 4dfc256

Please sign in to comment.