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

in_forward: Add tag and add_tag_prefix parameters #2396

Merged
merged 2 commits into from
Apr 25, 2019

Conversation

repeatedly
Copy link
Member

Signed-off-by: Masahiro Nakagawa repeatedly@gmail.com

Which issue(s) this PR fixes:
none

What this PR does / why we need it:
I sometimes receive this request from users for aggregator.
There are several reasons:

  • Port based tag handling
<source>
  @type forward
  port 24224
  add_tag_prefix cluster1
</source>

<source>
  @type forward
  port 24225
  add_tag_prefix cluster2
</source>

We can simulate this by adding new field for cluster detection in forwarder side and check it in aggregator side. But it makes configuration complicated.

  • Make tag handling cost lower

We can rewrite tag with route or similar plugins but it has performance penalty for large traffic.

The implementation is very simple and it resolves above cases. So supporting these parameters is reasonable.

Docs Changes:
Will send a patch to fluentd-docs after merged.

Release Note:
Same as title.

Signed-off-by: Masahiro Nakagawa <repeatedly@gmail.com>
@repeatedly repeatedly added feature request *Deprecated Label* Use enhancement label in general v1 labels Apr 23, 2019
@repeatedly repeatedly requested a review from ganmacs April 23, 2019 14:08
@repeatedly repeatedly self-assigned this Apr 23, 2019
Copy link
Member

@ganmacs ganmacs left a comment

Choose a reason for hiding this comment

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

Port based tag handling

I think label is a good fit for these cases. Will you please tell me why not to use label?

@@ -293,6 +298,9 @@ def on_message(msg, chunk_size, conn)
log.warn "Input chunk size is larger than 'chunk_size_warn_limit':", tag: tag, host: conn.remote_host, limit: @chunk_size_warn_limit, size: chunk_size
end

tag = @tag.dup if @tag
tag = "#{@add_tag_prefix}.#{tag}" if @add_tag_prefix
Copy link
Member

Choose a reason for hiding this comment

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

Is it ok without checking tag is an empty string?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good catch. I will add empty check on configure.

@repeatedly
Copy link
Member Author

Yeah, label is one good approach but label itself doesn't change tag.
So this patch is also good for label combo, e.g. some output plugins use tag placeholder.

Copy link
Member

@ganmacs ganmacs left a comment

Choose a reason for hiding this comment

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

So this patch is also good for label combo, e.g. some output plugins use tag placeholder.

make sense to me to add this feature.

Signed-off-by: Masahiro Nakagawa <repeatedly@gmail.com>
@repeatedly repeatedly merged commit 2903f22 into master Apr 25, 2019
@repeatedly repeatedly deleted the in_forward-tag-parameters branch April 25, 2019 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request *Deprecated Label* Use enhancement label in general v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants