Skip to content

Commit

Permalink
out_cloudwatch_logs: simplify error logging for invalid responses
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Pettit <[email protected]>
  • Loading branch information
PettitWesley authored and nokute78 committed Nov 22, 2021
1 parent 07baa55 commit 10c3cd5
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions plugins/out_cloudwatch_logs/cloudwatch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,25 +1354,19 @@ int put_log_events(struct flb_cloudwatch *ctx, struct cw_flush *buf,
if (c->resp.status == 200) {
if (c->resp.data == NULL || c->resp.data_len == 0 || strstr(c->resp.data, AMZN_REQUEST_ID_HEADER) == NULL) {
/* code was 200, but response is invalid, treat as failure */
if (retry == FLB_TRUE) {
flb_plg_debug(ctx->ins, "Recieved code 200 but response was invalid, %s header not found",
AMZN_REQUEST_ID_HEADER);
}
else {
flb_plg_error(ctx->ins, "Recieved code 200 but response was invalid, %s header not found",
AMZN_REQUEST_ID_HEADER);
}
if (c->resp.data != NULL) {
flb_plg_debug(ctx->ins, "Could not find sequence token in "
"response: response body is empty: full data: `%.*s`", c->resp.data_len, c->resp.data);
}
flb_http_client_destroy(c);

if (retry == FLB_TRUE) {
flb_plg_debug(ctx->ins, "issuing immediate retry for invalid request");
flb_plg_debug(ctx->ins, "issuing immediate retry for invalid response");
retry = FLB_FALSE;
goto retry_request;
}
flb_plg_error(ctx->ins, "Recieved code 200 but response was invalid, %s header not found",
AMZN_REQUEST_ID_HEADER);
return -1;
}

Expand Down

0 comments on commit 10c3cd5

Please sign in to comment.