Skip to content

out_splunk: skip the flush if payload is empty #10314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions plugins/out_splunk/splunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,16 @@ static void cb_splunk_flush(struct flb_event_chunk *event_chunk,
&buf_data, &buf_size, ctx);
}

/* Skipping the flush if content length is 0 */
if (buf_size == 0) {
flb_plg_warn(ctx->ins, "Content length is 0, skipping flush");
if (buf_data) {
flb_sds_destroy(buf_data);
}
/* setting the ret to -1, so the next block will take care of clean up */
ret = -1;
}

if (ret == -1) {
flb_upstream_conn_release(u_conn);
FLB_OUTPUT_RETURN(FLB_ERROR);
Expand Down
Loading