Skip to content

Commit

Permalink
in_kubernetes_events: check http_get_response_data return val
Browse files Browse the repository at this point in the history
Signed-off-by: ryanohnemus <[email protected]>
  • Loading branch information
ryanohnemus committed May 1, 2024
1 parent 99bad45 commit 15cf21a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions plugins/in_kubernetes_events/kubernetes_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,14 @@ static int k8s_events_collect(struct flb_input_instance *ins,
}
/* NOTE: skipping any processing after streaming socket closes */

if (ctx->streaming_client->resp.status != 200) {
flb_plg_warn(ins, "events watch failure, http_status=%d payload=%s",
ctx->streaming_client->resp.status, ctx->streaming_client->resp.payload);
if (ctx->streaming_client->resp.status != 200 || ret == FLB_HTTP_ERROR) {
if (ret == FLB_HTTP_ERROR) {
flb_plg_warn(ins, "kubernetes chunked stream error.");
}
else {
flb_plg_warn(ins, "events watch failure, http_status=%d payload=%s",
ctx->streaming_client->resp.status, ctx->streaming_client->resp.payload);
}

flb_http_client_destroy(ctx->streaming_client);
flb_upstream_conn_release(ctx->current_connection);
Expand Down

0 comments on commit 15cf21a

Please sign in to comment.