Sha256: 9a45556a72b1186432c8e2ef4eb812a09a3b612e1405a8a989bbd9a6f664dc91

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 Bytes

Contents

require 'fluent/plugin/filter_where/parser.tab'

module Fluent; module FilterWhere; end; end
module Fluent
  module FilterWhere::Core
    def initialize
      super
    end
    
    def self.included(klass)
      klass.config_param :where, :string, :desc => 'The SQL-like WHERE statement.'
    end

    def configure(conf)
      super

      parser = Fluent::FilterWhere::Parser.new
      @scanner = parser.scan(@where)
    end

    def filter(tag, time, record)
      if @scanner.eval(record)
        record
      else
        nil # remove
      end
    rescue => e
      log.warn "filter_where: #{e.class} #{e.message} #{e.backtrace.first}"
      log.debug "filter_where:: tag:#{tag} time:#{time} record:#{record}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-filter_where-1.0.1 lib/fluent/plugin/filter_where/core.rb
fluent-plugin-filter_where-1.0.0 lib/fluent/plugin/filter_where/core.rb