-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in_http: Support for Content-Type application/x-ndjson #3511
Comments
@chrisbertsch I implemented the "ndjson" support and just released Plese refer to the release note for details: https://github.com/fluent/fluentd/releases/tag/v1.14.5 Feel free to ask me if you have any feedback. |
So I just tested this but when I attempt to send multiple lines I get a HTTP 400 response code with Contents of test.ndjson with line endings shown.
$ cat -e test.ndjson
{"message":"Test 1"}$
{"message":"Test 2"}$
$ cat test.ndjson | curl -v -d @- -H 'Content-Type: application/x-ndjson' http://127.0.0.1:8080/test
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /test HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-Type: application/x-ndjson
> Content-Length: 40
>
* upload completely sent off: 40 out of 40 bytes
< HTTP/1.1 400 Bad Request
< Content-Type: text/plain
< Connection: Keep-Alive
< Content-Length: 56
<
400 Bad Request
undefined method `[]=' for nil:NilClass
* Connection #0 to host 127.0.0.1 left intact |
@chrisbertsch Can you post I guess your coniguration somehow turns off the batch processing logic, |
@fujimotos My source config is as follows.
|
@chrisbertsch It turned out that
For this reason, invalid data (like To post ndjson payloads correctly, you need to use $ cat test.ndjson | curl -v --data-binary @- -H 'Content-Type: application/x-ndjson' http://127.0.0.1:8080/test I can confirm it works with Fluentd v1.14.5. |
@fujimotos I can confirm this works now. Sorry I completely missed that during my testing. Do you know wow long it takes for a new Fluentd version to show up in the latest td-agent package? |
Ask @ashie. He is the downstream's manager! |
Is your feature request related to a problem? Please describe.
Moving away from a legacy application in which logs were sent over HTTP as newline delimited JSON objects. With the added support for newline delimited JSON added to the in_http plugin Fluentd would be a drop-in replacement.
I see that the out_http plugin supports application/x-ndjson so this enhancement to the HTTP input would be complementary to the HTTP output plugin's support of newline-delimited JSON objects.
https://docs.fluentd.org/output/http#content_type
Describe the solution you'd like
Implement support for Content-Type application/x-ndjson for newline-delimited JSON objects to be summited via the in_http input plugin.
https://docs.fluentd.org/input/http#how-to-use-http-content-type-header
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: