-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add placeholder support for stream names #174
Add placeholder support for stream names #174
Conversation
2b706af
to
19cce69
Compare
We can send events into different kinesis_streams with the following configuration: <source>
@type tail
path "data.json"
tag "in.json"
read_from_head true
<parse>
@type "json"
</parse>
</source>
<match in.json>
@type kinesis_streams
stream_name "${$.key.nested}"
aws_key_id xxxxxx
aws_sec_key xxxxxx
<buffer $.key.nested>
@type "memory"
</buffer>
</match> Sending data: {"key":{"nested":"cosmo0920-fluentd-test1","message":"hoge"}}
{"key":{"nested":"cosmo0920-fluentd-test2","message":"huga"}}
{"key":{"nested":"cosmo0920-fluentd-test1","message":"hoo"}}
{"key":{"nested":"cosmo0920-fluentd-test2","message":"bar"}}
{"key":{"nested":"cosmo0920-fluentd-test2","message":"baz"}} result:
|
4e1437d
to
09f1acc
Compare
I've confirmed that this PR works on real AWS environemnt (ap-northeast-1) and added test cases for built-in placeholders. @riywo @simukappu Could you kindly take a look? |
any update on this feature? 🤔 |
@mathetake Could you try this PR's patch in your AWS environment? |
Just built this and gave it a try. Got this...
|
@roscoecairney Could you share your configuration? |
Hi, sure thing. I'm pulling in docker logs, using the kubernetes filter to enrich them, grepping out the ones without a given annotation and then using that annotation for the kinesis stream name.
|
Aha! Got it. Could you try the following buffer configuration? <buffer $.kubernetes.annotations.kinesis_stream>
flush_interval 1
chunk_limit_size "#{ENV['FLUENT_KINESIS_STREAMS_CHUNK_LIMIT_SIZE'] || '1m'}"
flush_thread_interval 0.1
flush_thread_burst_interval 0.01
flush_thread_count 15
</buffer> Fluentd built-in placeholder requests to include target key information with buffer attributes. |
Thanks @cosmo0920 - that's working perfectly. Hope this gets merged in soon. |
@roscoecairney Thank you for your testing! |
Thanks for notifying it. |
f5f53a1
to
5a52502
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added very small comments. Can you check it?
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec| | |||
spec.require_paths = ["lib"] | |||
spec.required_ruby_version = '>= 2.1' | |||
|
|||
spec.add_dependency "fluentd", ">= 0.14.10", "< 2" | |||
spec.add_dependency "fluentd", ">= 0.14.22", "< 2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to update dependencies in README Fluentd 0.14.10+
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 8d2ac48.
@cosmo0920 Could you confirm to the formal statement below? "By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license." We appreciate your understanding and strong contribution! |
Yep. I've written these patches under the terms of the Apache license 2.0. |
Great, thank you! |
Sure. |
8d2ac48
to
af9acb7
Compare
I've squashed this PR into one commit. |
Thank you! Proceed to our checking. Please wait for a moment. |
Related to #165.
We can handle to send different stream nams with extract_placeholders API which is the brand new Fluentd v1 API.
BTW, how to write test code for this feature?