Class: Fluent::EngineClass

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/fms_fluentd_ext.rb

Instance Method Summary collapse

Instance Method Details

#get_type_from_klass(klass) ⇒ Object



133
134
135
136
137
# File 'lib/fluent/plugin/fms_fluentd_ext.rb', line 133

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



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/fluent/plugin/fms_fluentd_ext.rb', line 98

def set_tag_path(prefix = '')
  @matches.each { |m|
    if m.is_a?(Match)
      tag_path = "#{prefix}/#{m.pattern_str}"
      m.output.tag_path = tag_path
      if m.output.is_a?(MultiOutput) && m.output.respond_to?(:outputs)
        set_tag_path_to_multi_output(tag_path, m.output)
      end
      if m.output.respond_to?(:output) && m.output.output.is_a?(Output)
        set_tag_path_to_wrap_output(tag_path, m.output)
      end
    end
  }
end

#set_tag_path_to_multi_output(prefix, multi_output) ⇒ Object



113
114
115
116
117
118
# File 'lib/fluent/plugin/fms_fluentd_ext.rb', line 113

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



125
126
127
128
129
130
131
# File 'lib/fluent/plugin/fms_fluentd_ext.rb', line 125

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



120
121
122
123
# File 'lib/fluent/plugin/fms_fluentd_ext.rb', line 120

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