File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -916,12 +916,24 @@ static void cb_es_flush(struct flb_event_chunk *event_chunk,
916916 if (ctx -> trace_error ) {
917917 /*
918918 * If trace_error is set, trace the actual
919- * input/output to Elasticsearch that caused the problem.
919+ * response from Elasticsearch explaining the problem.
920+ * Trace_Output can be used to see the request.
920921 */
921- flb_plg_debug (ctx -> ins , "error caused by: Input\n%s\n" ,
922- pack );
923- flb_plg_error (ctx -> ins , "error: Output\n%s" ,
924- c -> resp .payload );
922+ if (pack_size < 4000 ) {
923+ flb_plg_debug (ctx -> ins , "error caused by: Input\n%.*s\n" ,
924+ (int ) pack_size , pack );
925+ }
926+ if (c -> resp .payload_size < 4000 ) {
927+ flb_plg_error (ctx -> ins , "error: Output\n%s" ,
928+ c -> resp .payload );
929+ } else {
930+ /*
931+ * We must use fwrite since the flb_log functions
932+ * will truncate data at 4KB
933+ */
934+ fwrite (c -> resp .payload , 1 , c -> resp .payload_size , stderr );
935+ fflush (stderr );
936+ }
925937 }
926938 goto retry ;
927939 }
You can’t perform that action at this time.
0 commit comments