out_http: on error, print HTTP response payload if available
@@ -183,8 +183,15 @@ static int http_post(struct flb_out_http *ctx,
*
*/
if (c->resp.status < 200 || c->resp.status > 205) {
+ if (c->resp.payload && c->resp.payload_size > 0) {
+ flb_plg_error(ctx->ins, "%s:%i, HTTP status=%i\n%s",
+ ctx->host, ctx->port,
+ c->resp.status, c->resp.payload);
+ }
+ else {
flb_plg_error(ctx->ins, "%s:%i, HTTP status=%i",
ctx->host, ctx->port, c->resp.status);
+ }
out_ret = FLB_RETRY;
}
else {
