Class: Fluent::Redis_SlowlogInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_redis_slowlog.rb

Instance Method Summary collapse

Constructor Details

#initializeRedis_SlowlogInput

Returns a new instance of Redis_SlowlogInput.



11
12
13
14
# File 'lib/fluent/plugin/in_redis_slowlog.rb', line 11

def initialize
  super
  require 'redis'
end

Instance Method Details

#configure(conf) ⇒ Object



16
17
18
19
20
# File 'lib/fluent/plugin/in_redis_slowlog.rb', line 16

def configure(conf)
  super
  @log_id = 0
  @get_interval = @interval
end

#shutdownObject



38
39
40
41
# File 'lib/fluent/plugin/in_redis_slowlog.rb', line 38

def shutdown
  super
  @redis.quit
end

#startObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fluent/plugin/in_redis_slowlog.rb', line 22

def start
  super
  @redis = Redis.new(
    :host => @host, 
    :port => @port,
    :thread_safe => true
  )
  pong = @redis.ping
  begin
      unless pong == 'PONG'
          raise "fluent-plugin-redis-slowlog: cannot connect redis"
      end
  end
  @watcher = Thread.new(&method(:watch))
end