Does out_http supports only json: application/x-ndjson

72 views
Skip to first unread message

Nandan Reddy V

unread,
Mar 7, 2020, 12:12:19 PM3/7/20
to Fluentd Google Group
Hi All,

I am planning to use out_http plugin to implement a failover scenario. The idea is to use Fluentd to post application/json type message to a http endpoint (which is basically a rest API).

But the issue here is Fluentd supports only application/x-ndjson (new line delimited JSON format) and this is not supported by target API and the error logged is -

fluent.warn: {"error":"#<Fluent::UnrecoverableError: 415 Unsupported Media Type{\"timestamp\":1583475757779,\"status\":415,\"error\":\"Unsupported Media Type\",\"exception\":\"org.springframework.web.HttpMediaTypeNotSupportedException\",\"message\":\"Content type 'application/x-ndjson;charset=UTF-8' not supported\",\"path\":\"/api/watchproducer/v1.0\"}

Example match case I used as below:-

<match payloadtraffic.**>
@type http
endpoint http://12345.abcd.com/api/watchproducer/v1.0
open_timeout 2
<format>
@type json
add_newline false
</format>
<buffer>
@type file
path "/fluentd/buffers/#{ENV["HOSTNAME"]}/payloadtrafficdev.buffer"
flush_interval 10s
</buffer>
</match>


Is there a way I can send JSON payload to a http endpoint using out_http plugin

Balaji K

unread,
Mar 7, 2020, 8:32:01 PM3/7/20
to flu...@googlegroups.com
Can you try giving serializer after endpoint ?
  serializer      json  <== like this ..

rgds
Balaji Kamal Kannadassan

--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fluentd/b7a0598c-a90e-43a9-9e69-83e60a60b377%40googlegroups.com.


--
Balaji Kamal Kannadassan

Nandan Reddy V

unread,
Mar 8, 2020, 3:33:42 PM3/8/20
to Fluentd Google Group
I did try putting  below statement , but it gives me the same error 
serializer json

Mr. Fiber

unread,
Mar 10, 2020, 4:43:46 AM3/10/20
to Fluentd Google Group
I assume you use built-in `http` output plugin.
If your endpoint can accept line-limited json with `application/json`,
put `content_type application/json` is one way.

If you want to send 1 json with `application/json`,
you need to use 3rd party fluent-plugin-out-http.


On Mon, Mar 9, 2020 at 4:33 AM Nandan Reddy V <nandan...@gmail.com> wrote:
I did try putting  below statement , but it gives me the same error 
serializer json

--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages