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: Pass tag dynamically in header #475

Merged
merged 1 commit into from
May 18, 2018

Conversation

brava-vinh
Copy link
Contributor

The http plugin currently not sending the message's tag. The in_http
plugin of Fluentd use the URI as tag. If we want to keep the original
tag then we have to define multipe output section per tag to map it to
URI. This change send the tag in a header(the headername can define in
config file), and it's up to the receiver to parse the header and
replace the tag.

The use case is to use this plugin in place of SecureForward plugin
because it's easier to maintain and config terminating TLS at load balancer
level, which probably a part of infrastructure already, comparing
with maintain TLS per fluentd instance.

@brava-vinh
Copy link
Contributor Author

Hi @edsiper Any feedback on this feature? Does it have any change to get merge or the feature is too broad/redundant? Thanks.

if (ctx->headertag_name) {
flb_http_add_header(c,
ctx->headertag_name,
strlen(ctx->headertag_name),
Copy link
Member

Choose a reason for hiding this comment

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

Since ctx->headertag_name length never change, can you set it in the context to avoid strlen() every time ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@edsiper Thanks. That makes sense. let me change it and also rebase with current master to make it easier for merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@edsiper Could you review again? I pre-compute and store in context. THanks.

@brava-vinh brava-vinh force-pushed the out_http-pass-tag-in-header branch 3 times, most recently from 4ce8c9d to f5b48f2 Compare February 10, 2018 07:19
@brava-vinh
Copy link
Contributor Author

brava-vinh commented Feb 28, 2018

@edsiper I have fixed the code. Please see if you can bring this into next release. I think it help lots of user, especially people run fluentd in K8S will like to use HTTPS instead of TCP with SSL since it's easier to configure nginx ingress with https. Thanks you so much.

I'll also prepare a doc PR into https://github.com/fluent/fluent-bit-docs

fluent/fluent-bit-docs#55

@brava-vinh
Copy link
Contributor Author

@edsiper Hi, any signal this can be consider a feature to be merged ;). I'm very open to do any change that necessary or docs update.

fluent/fluent-bit-docs#55

@edsiper
Copy link
Member

edsiper commented May 18, 2018

@brava-vinh sorry for the delay.

Last two minor changes to get it merged:

  • here I think it should validate the char pointer instead of the integer value twice.
  • rename property and field in the config from headertag_name to header_tag

once done we are ready to merge it.

@brava-vinh
Copy link
Contributor Author

@edsiper Thank you. Let me make the necessary change and also rebase with current master

@edsiper edsiper self-assigned this May 18, 2018
@edsiper edsiper added the waiting-for-user Waiting for more information, tests or requested changes label May 18, 2018
@brava-vinh brava-vinh force-pushed the out_http-pass-tag-in-header branch 2 times, most recently from 6a732c4 to 25dd579 Compare May 18, 2018 19:08
Signed-off-by: Vinh <[email protected]>
The http plugin currently not sending the message's tag. The in_http
plugin of Fluentd use the URI as tag. If we want to keep the original
tag then we have to define multipe output section per tag to map it to
URI. This change send the tag in a header(the headername can define in
config file), and it's up to the receiver to parse the header and
replace the tag.
@brava-vinh brava-vinh force-pushed the out_http-pass-tag-in-header branch from 25dd579 to b4e0995 Compare May 18, 2018 19:11
@brava-vinh
Copy link
Contributor Author

@edsiper All build are passed now.

I also updated the doc: https://github.com/fluent/fluent-bit-docs/pull/55/files with an reference to how this can be used https://github.com/brava-vinh/fluent-bit-docs/blob/59b50812f1dd09a7b8ecd6d2555712082bd4301e/output/http.md

I hoped to make the doc as clear as possible on why we need this, how we used it

@edsiper edsiper merged commit fb7a6ca into fluent:master May 18, 2018
@edsiper
Copy link
Member

edsiper commented May 18, 2018

thanks, we are good now :)

edsiper pushed a commit that referenced this pull request May 21, 2018
The http plugin currently not sending the message's tag. The in_http
plugin of Fluentd use the URI as tag. If we want to keep the original
tag then we have to define multipe output section per tag to map it to
URI. This change send the tag in a header(the headername can define in
config file), and it's up to the receiver to parse the header and
replace the tag.

Signed-off-by: Vinh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-user Waiting for more information, tests or requested changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants