Last active
December 14, 2015 13:08
-
-
Save y-ken/5091010 to your computer and use it in GitHub Desktop.
I'd like to support mixin for my Fluentd Plugins. But It won't work. Would you please tell me the way to work fine?
(FluentdプラグインのMixin対応を行おうとしているが、期待した動作にならない訳は何故でしょうか。)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Test Run Command(テスト実行したコマンド) | |
curl http://localhost:8888/test -F 'json={"message":"foo"}' | |
### actual logging output(実際のログ出力) | |
2013-03-06 00:14:53 +0900 debug.mixin: {"message":"foo"} | |
### expected logging output(期待したログ出力) | |
2013-03-06 00:14:53 +0900 debug.mixin: {"message":"foo","my_tag":"test","my_time":"2013-03-05T15:14:53Z"} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
type http | |
port 8888 | |
</source> | |
<match test> | |
type rewrite_tag_filter | |
rewriterule1 message .+ debug.mixin | |
include_time_key true | |
time_key my_time | |
include_tag_key true | |
tag_key my_tag | |
</match> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/fluent/plugin/out_rewrite_tag_filter.rb b/lib/fluent/plugin/out_rewrite_tag_filter.rb | |
index eec8e4f..890ceba 100644 | |
--- a/lib/fluent/plugin/out_rewrite_tag_filter.rb | |
+++ b/lib/fluent/plugin/out_rewrite_tag_filter.rb | |
@@ -1,6 +1,14 @@ | |
class Fluent::RewriteTagFilterOutput < Fluent::Output | |
Fluent::Plugin.register_output('rewrite_tag_filter', self) | |
+ include Fluent::HandleTagNameMixin | |
+ | |
+ include Fluent::SetTagKeyMixin | |
+ config_set_default :include_tag_key, true | |
+ | |
+ include Fluent::SetTimeKeyMixin | |
+ config_set_default :include_time_key, true | |
+ | |
PATTERN_MAX_NUM = 200 | |
config_param :rewriterule1, :string # string: NAME REGEXP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After I added filter_record() before emit call, it works fine. Thank you.