class Fluent::Plugin::MapOutput
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_map.rb, line 38 def configure(conf) log.warn "out_map is now deprecated. It will be removed in a future release. Please consider to use filter_map." super @format = determine_format() configure_format() @map = create_map(conf) @map_support = Fluent::Plugin::MapSupport.new(@map, self) end
configure_format()
click to toggle source
# File lib/fluent/plugin/out_map.rb, line 65 def configure_format() case @format when "map" # pass when "record" @tag ||= @key raise Fluent::ConfigError, "multi and 3 parameters(tag, time, and record) are not compatible" if @multi when "multimap" # pass. else raise Fluent::ConfigError, "format #{@format} is invalid." end end
create_map(conf)
click to toggle source
# File lib/fluent/plugin/out_map.rb, line 79 def create_map(conf) # return string like double array. case @format when "map" parse_map() when "record" "[[#{@tag}, #{@time}, #{@record}]]" when "multimap" parse_multimap(conf) end end
determine_format()
click to toggle source
# File lib/fluent/plugin/out_map.rb, line 53 def determine_format() if @format @format elsif @map "map" elsif (@tag || @key) && @time && @record "record" else raise Fluent::ConfigError, "Any of map, 3 parameters(tag, time, and record) or format is required " end end
multi_workers_ready?()
click to toggle source
# File lib/fluent/plugin/out_map.rb, line 34 def multi_workers_ready? true end
process(tag, es)
click to toggle source
# File lib/fluent/plugin/out_map.rb, line 91 def process(tag, es) begin tag_output_es = @map_support.do_map(tag, es) tag_output_es.each_pair do |tag, output_es| router.emit_stream(tag, output_es) end tag_output_es rescue SyntaxError => e log.error "map command is syntax error: #{@map}" e #for test end end
stop()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_map.rb, line 47 def stop @map_support.stop super end