diff --git a/plugins/in_splunk/splunk_prot.c b/plugins/in_splunk/splunk_prot.c index d55433f6b85..af0ebc0c02b 100644 --- a/plugins/in_splunk/splunk_prot.c +++ b/plugins/in_splunk/splunk_prot.c @@ -642,7 +642,7 @@ static int process_hec_payload(struct flb_splunk *ctx, struct splunk_conn *conn, ret = handle_hec_payload(ctx, type, tag, request->data.data, request->data.len); } - return 0; + return ret; } static int process_hec_raw_payload(struct flb_splunk *ctx, struct splunk_conn *conn, @@ -887,10 +887,11 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn, return -1; } - if (!ret) { + if (ret < 0) { send_json_message_response(conn, 400, "{\"text\":\"Invalid data format\",\"code\":6}"); + } else { + send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } - send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } else if (strcasecmp(uri, "/services/collector/event/1.0") == 0 || strcasecmp(uri, "/services/collector/event") == 0 || @@ -910,10 +911,11 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn, return -1; } - if (!ret) { + if (ret < 0) { send_json_message_response(conn, 400, "{\"text\":\"Invalid data format\",\"code\":6}"); + } else { + send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } - send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } else { send_response(conn, 400, "error: invalid HTTP endpoint\n");