class Fluent::BurrowFilter
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_burrow.rb, line 30 def configure(conf) super # Validate action actions = ['replace','overlay','inplace','prefix'] if not actions.include? @action raise Fluent::ConfigError, "Invalid 'action', must be one of #{actions.join(',')}" end # Validate action-based restrictions if @action == 'inplace' and @keep_key raise Fluent::ConfigError, "Specifying 'keep_key' with action 'inplace' is not supported" end if @action == 'prefix' and not @data_prefix raise Fluent::ConfigError, "You must specify 'data_prefix' with action 'prefix'" end # Prepare fluent's built-in parser @parser = Fluent::Plugin.new_parser(@format) @parser.configure(conf) if @parser.respond_to?(:configure) end
filter(tag, time, record)
click to toggle source
# File lib/fluent/plugin/filter_burrow.rb, line 63 def filter(tag, time, record) raw_value = record[@key_name] if raw_value then new_time, new_values = nil, nil @parser.parse(raw_value) do |parsed_time, parsed_values| new_time = parsed_time new_values = parsed_values end if new_values then original_time = record[@record_time_key] new_time ||= original_time # Overlay new record on top of original record? new_record = case @action when 'inplace' record.merge({@key_name => new_values}) when 'overlay' record.merge(new_values) when 'replace' new_values when 'prefix' record.merge({@data_prefix => new_values}) end # Keep the key? if ['overlay','replace','prefix'].include? @action if not @keep_key and new_record.has_key?(@key_name) new_record.delete(@key_name) end end # Preserve 'time' key? if @keep_time new_record[@record_time_key] = original_time end new_record end end end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_burrow.rb, line 58 def shutdown super end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_burrow.rb, line 53 def start super end