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 committed Oct 18, 2023
1 parent ef0ac2a commit c73d01e
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 c73d01e

Please sign in to comment.