class Fluent::KatsubushiFilter

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_katsubushi.rb, line 11
def configure(conf)
  super
end
filter(tag, time, record) click to toggle source
# File lib/fluent/plugin/filter_katsubushi.rb, line 24
def filter(tag, time, record)
  tries = 3
  while tries >= 0 do
    begin
      id = @client.get('1', false)
      record[@id_key] = @integer ? id.to_i : id.to_s
    rescue => e
      $log.warn("Couldn't get id from katsubushi: #{e}") if tries == 0
      @client.reset
    ensure
      tries = tries - 1
    end
  end
  record
end
shutdown() click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_katsubushi.rb, line 20
def shutdown
  super
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_katsubushi.rb, line 15
def start
  super
  @client = ::Memcached.new(["#{@host}:#{@port}"])
end