class Fluent::Plugin::SplunkOutput::MatchFormatter

Public Class Methods

new(pattern, formatter) click to toggle source
# File lib/fluent/plugin/out_splunk/match_formatter.rb, line 6
def initialize(pattern, formatter)
  # based on fluentd/lib/fluent/event_router.rb
  patterns = pattern.split(/\s+/).map do |str|
    Fluent::MatchPattern.create(str)
  end
  @pattern =
    if patterns.length == 1
      patterns[0]
    else
      Fluent::OrMatchPattern.new(patterns)
    end
  @formatter = formatter
end

Public Instance Methods

format(tag, time, record) click to toggle source
# File lib/fluent/plugin/out_splunk/match_formatter.rb, line 24
def format(tag, time, record)
  @formatter.format tag, time, record
end
match?(tag) click to toggle source
# File lib/fluent/plugin/out_splunk/match_formatter.rb, line 20
def match?(tag)
  @pattern.match tag
end