Skip to content

Commit

Permalink
out_es: fix trace_error truncating the response
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Pettit <[email protected]>
  • Loading branch information
PettitWesley committed Jul 25, 2022
1 parent 5ba44a5 commit e46c20b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions plugins/out_es/es.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,12 +886,24 @@ static void cb_es_flush(struct flb_event_chunk *event_chunk,
if (ctx->trace_error) {
/*
* If trace_error is set, trace the actual
* input/output to Elasticsearch that caused the problem.
* response from Elasticsearch explaining the problem.
* Trace_Output can be used to see the request.
*/
flb_plg_debug(ctx->ins, "error caused by: Input\n%s\n",
pack);
flb_plg_error(ctx->ins, "error: Output\n%s",
c->resp.payload);
if (pack_size < 4000) {
flb_plg_debug(ctx->ins, "error caused by: Input\n%s\n",
pack);
}
if (c->resp.payload_size < 4000) {
flb_plg_error(ctx->ins, "error: Output\n%s",
c->resp.payload);
} else {
/*
* We must use fwrite since the flb_log functions
* will truncate data at 4KB
*/
fwrite(c->resp.payload, 1, c->resp.payload_size, stderr);
fflush(stderr);
}
}
goto retry;
}
Expand Down

0 comments on commit e46c20b

Please sign in to comment.