Skip to content

Commit

Permalink
out_forward: Add compressed=gzip option for non log types of events
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored and edsiper committed Nov 6, 2023
1 parent c4f067e commit 55abf8d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/out_forward/forward_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ static int append_options(struct flb_forward *ctx,
msgpack_pack_str(mp_pck, 4);
msgpack_pack_str_body(mp_pck, "gzip", 4);
}
else if (fc->compress == COMPRESS_GZIP &&
/* for metrics or traces, we're also able to send as
* gzipped payloads */
(event_type == FLB_EVENT_TYPE_METRICS ||
event_type == FLB_EVENT_TYPE_TRACES)) {
flb_mp_map_header_append(&mh);
msgpack_pack_str(mp_pck, 10);
msgpack_pack_str_body(mp_pck, "compressed", 10);
msgpack_pack_str(mp_pck, 4);
msgpack_pack_str_body(mp_pck, "gzip", 4);
}

/* event type (FLB_EVENT_TYPE_LOGS, FLB_EVENT_TYPE_METRICS, FLB_EVENT_TYPE_TRACES) */
flb_mp_map_header_append(&mh);
Expand Down

0 comments on commit 55abf8d

Please sign in to comment.