Skip to content

Commit

Permalink
out_http: Use x-ndjson content type for json_lines
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Rüger <[email protected]>
  • Loading branch information
mrueg authored and edsiper committed Apr 27, 2024
1 parent 5687b89 commit 3529bbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/out_http/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,20 @@ static int http_post(struct flb_out_http *ctx,
}
else if ((ctx->out_format == FLB_PACK_JSON_FORMAT_JSON) ||
(ctx->out_format == FLB_PACK_JSON_FORMAT_STREAM) ||
(ctx->out_format == FLB_PACK_JSON_FORMAT_LINES) ||
(ctx->out_format == FLB_HTTP_OUT_GELF)) {
flb_http_add_header(c,
FLB_HTTP_CONTENT_TYPE,
sizeof(FLB_HTTP_CONTENT_TYPE) - 1,
FLB_HTTP_MIME_JSON,
sizeof(FLB_HTTP_MIME_JSON) - 1);
}
else if ((ctx->out_format == FLB_PACK_JSON_FORMAT_LINES)) {
flb_http_add_header(c,
FLB_HTTP_CONTENT_TYPE,
sizeof(FLB_HTTP_CONTENT_TYPE) - 1,
FLB_HTTP_MIME_NDJSON,
sizeof(FLB_HTTP_MIME_NDJSON) - 1);
}
else if ((ctx->out_format == FLB_HTTP_OUT_MSGPACK)) {
flb_http_add_header(c,
FLB_HTTP_CONTENT_TYPE,
Expand Down
1 change: 1 addition & 0 deletions plugins/out_http/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define FLB_HTTP_CONTENT_TYPE "Content-Type"
#define FLB_HTTP_MIME_MSGPACK "application/msgpack"
#define FLB_HTTP_MIME_JSON "application/json"
#define FLB_HTTP_MIME_NDJSON "application/x-ndjson"

#ifdef FLB_HAVE_SIGNV4
#ifdef FLB_HAVE_AWS
Expand Down

0 comments on commit 3529bbb

Please sign in to comment.