Skip to content
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

out_http: Add JSON Streaming output format #477

Merged
merged 1 commit into from Feb 28, 2018

Conversation

ffscl
Copy link
Contributor

@ffscl ffscl commented Jan 4, 2018

Support for concatenated JSON Streaming format.
https://en.wikipedia.org/wiki/JSON_streaming#Concatenated_JSON

This is an independent output format behind flag format=json_stream
Useful when flushing buffer to systems that doesn't accept msgpack or JSON arrays

FYI - I've applied gnu-indent with the apache style guide rules https://httpd.apache.org/dev/styleguide.html

int in_escape = FLB_FALSE;

for (p = json_buf; p!=end; p++) {
if (in_escape)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the function/role of in_escape ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This skips checking *p if the previous character was an escape character. This addresses the case of:
[{"foo":"bar\""},{"fizz":"buzz\""}]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@edsiper
Copy link
Member

edsiper commented Feb 7, 2018

Please make only one commit on top of GIT Master and we will be ready for merge.

@edsiper
Copy link
Member

edsiper commented Feb 9, 2018

@ffscl ping

@ffscl
Copy link
Contributor Author

ffscl commented Feb 10, 2018

Sorry! Will get this done this week so you can close this.

https://en.wikipedia.org/wiki/JSON_streaming#Concatenated_JSON

This is an independent output format behind flag format=json_stream
Useful when flushing to system that doesn't accept msgpack or JSON arrays

Signed-off-by: Brendan <brendan.wreford@anz.com>
@ffscl ffscl force-pushed the feature/out_http_json_stream branch from 4948172 to 40a6728 Compare February 20, 2018 05:39
@ffscl
Copy link
Contributor Author

ffscl commented Feb 20, 2018

@edsiper please review now.

@edsiper edsiper merged commit 82608bb into fluent:master Feb 28, 2018
@brandoncole
Copy link
Contributor

I was looking up at the implementation of this and have another use case for log ingestion where a provider (Loggly) in this case expects JSON separated by newlines. I've created an issue here that summarizes it - thought perhaps I might get some thoughts from @ffscl and @edsiper in the issue below since you both appear to be quite familiar with this area of the code? Thanks!

#579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants