From c73d01eaa418d1fff00c8defe379680ca67a7213 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Wed, 18 Oct 2023 16:28:44 +0900 Subject: [PATCH] out_forward: Add compressed=gzip option for non log types of events Signed-off-by: Hiroshi Hatake --- plugins/out_forward/forward_format.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/out_forward/forward_format.c b/plugins/out_forward/forward_format.c index 48dedd862d6..00aff93d208 100644 --- a/plugins/out_forward/forward_format.c +++ b/plugins/out_forward/forward_format.c @@ -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);