Class: Fluent::EngineClass
- Inherits:
-
Object
- Object
- Fluent::EngineClass
- Defined in:
- lib/fluent/plugin/tdms_ext_fluentd.rb,
lib/fluent/plugin/tdms_ext_fluentd.rb,
lib/fluent/plugin/tdms_ext_fluentd.rb
Overview
Helper methods for tag setting
Instance Method Summary collapse
- #get_type_from_klass(klass) ⇒ Object
- #set_tag_path(prefix = '') ⇒ Object
- #set_tag_path_in_rules(prefix, rules) ⇒ Object
- #set_tag_path_to_multi_output(prefix, multi_output) ⇒ Object
- #set_tag_path_to_output(prefix, output) ⇒ Object
- #set_tag_path_to_wrap_output(prefix, wrap_output) ⇒ Object
Instance Method Details
#get_type_from_klass(klass) ⇒ Object
170 171 172 173 174 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 170 def get_type_from_klass(klass) Plugin.instance_variable_get(:@output).each { |name, output| return name if output == klass } end |
#set_tag_path(prefix = '') ⇒ Object
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 92 def set_tag_path(prefix = '') rules = @root_agent.event_router.instance_variable_get(:@match_rules) set_tag_path_in_rules(prefix, rules) labels = @root_agent.labels labels.each { |n, label| rules = label.event_router.instance_variable_get(:@match_rules) set_tag_path_in_rules("#{prefix}/#{n}", rules) } end |
#set_tag_path_in_rules(prefix, rules) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 103 def set_tag_path_in_rules(prefix, rules) rules.each { |rule| tag_path = "#{prefix}/#{rule.pattern_str}" collector = rule.collector if collector.is_a?(Output) collector.tag_path = tag_path if collector.is_a?(MultiOutput) && collector.respond_to?(:outputs) set_tag_path_to_multi_output(tag_path, collector) end if collector.respond_to?(:output) && collector.output.is_a?(Output) set_tag_path_to_wrap_output(tag_path, collector) end end } end |
#set_tag_path_to_multi_output(prefix, multi_output) ⇒ Object
150 151 152 153 154 155 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 150 def set_tag_path_to_multi_output(prefix, multi_output) new_prefix = "#{prefix}/#{get_type_from_klass(multi_output.class)}" multi_output.outputs.each_with_index { |output, index| set_tag_path_to_output("#{new_prefix}.#{index}", output) } end |
#set_tag_path_to_output(prefix, output) ⇒ Object
162 163 164 165 166 167 168 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 162 def set_tag_path_to_output(prefix, output) if output.is_a?(MultiOutput) set_tag_path_to_multi_output(prefix, output) else output.tag_path = "#{prefix}/#{get_type_from_klass(output.class)}" end end |
#set_tag_path_to_wrap_output(prefix, wrap_output) ⇒ Object
157 158 159 160 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 157 def set_tag_path_to_wrap_output(prefix, wrap_output) new_prefix = "#{prefix}/#{get_type_from_klass(wrap_output.class)}" set_tag_path_to_output(new_prefix, wrap_output.output) end |