Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out_http: don't retry non retryable 4xx status codes #8861

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean logs will be lost when the endpoint is unavailable?

Copy link
Contributor Author

@IsraelZeromski IsraelZeromski May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. if return a code in 4xx range except 429, this means that the are an error in client side in consequence that records will not be retry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fluentd has a setting for retryable response codes: https://docs.fluentd.org/output/http#retryable_response_codes maybe we could add this as well?

}
else {
out_ret = FLB_RETRY;
}
}
else {
if (ctx->log_response_payload &&
Expand Down
Loading