Skip to content

Commit 3529bbb

Browse files
mruegedsiper
authored andcommitted
out_http: Use x-ndjson content type for json_lines
Signed-off-by: Manuel Rüger <[email protected]>
1 parent 5687b89 commit 3529bbb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

plugins/out_http/http.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,20 @@ static int http_post(struct flb_out_http *ctx,
178178
}
179179
else if ((ctx->out_format == FLB_PACK_JSON_FORMAT_JSON) ||
180180
(ctx->out_format == FLB_PACK_JSON_FORMAT_STREAM) ||
181-
(ctx->out_format == FLB_PACK_JSON_FORMAT_LINES) ||
182181
(ctx->out_format == FLB_HTTP_OUT_GELF)) {
183182
flb_http_add_header(c,
184183
FLB_HTTP_CONTENT_TYPE,
185184
sizeof(FLB_HTTP_CONTENT_TYPE) - 1,
186185
FLB_HTTP_MIME_JSON,
187186
sizeof(FLB_HTTP_MIME_JSON) - 1);
188187
}
188+
else if ((ctx->out_format == FLB_PACK_JSON_FORMAT_LINES)) {
189+
flb_http_add_header(c,
190+
FLB_HTTP_CONTENT_TYPE,
191+
sizeof(FLB_HTTP_CONTENT_TYPE) - 1,
192+
FLB_HTTP_MIME_NDJSON,
193+
sizeof(FLB_HTTP_MIME_NDJSON) - 1);
194+
}
189195
else if ((ctx->out_format == FLB_HTTP_OUT_MSGPACK)) {
190196
flb_http_add_header(c,
191197
FLB_HTTP_CONTENT_TYPE,

plugins/out_http/http.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define FLB_HTTP_CONTENT_TYPE "Content-Type"
2727
#define FLB_HTTP_MIME_MSGPACK "application/msgpack"
2828
#define FLB_HTTP_MIME_JSON "application/json"
29+
#define FLB_HTTP_MIME_NDJSON "application/x-ndjson"
2930

3031
#ifdef FLB_HAVE_SIGNV4
3132
#ifdef FLB_HAVE_AWS

0 commit comments

Comments
 (0)