Sha256: 56045a1ec3b77fa5a969a40eaee2b74c92bae9f5659ce06accba95533f5a8858

Contents?: true

Size: 584 Bytes

Versions: 18

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

require 'fluent/match'

class Fluent::Plugin::SplunkOutput::MatchFormatter
  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

  def match?(tag)
    @pattern.match tag
  end

  def format(tag, time, record)
    @formatter.format tag, time, record
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
fluent-plugin-splunk-hec-1.3.3 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.3.2 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.3.1 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.3.0 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.13 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.12 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.11 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.10 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.9 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.8 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.7 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.6 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.5 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.4 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.3 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.2 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.1 lib/fluent/plugin/out_splunk/match_formatter.rb
fluent-plugin-splunk-hec-1.2.0 lib/fluent/plugin/out_splunk/match_formatter.rb