Class: Fluent::Rds_SlowlogInput

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

Instance Method Summary collapse

Constructor Details

#initializeRds_SlowlogInput

Returns a new instance of Rds_SlowlogInput.



15
16
17
18
# File 'lib/fluent/plugin/in_rds_slowlog.rb', line 15

def initialize
  super
  require 'mysql2'
end

Instance Method Details

#configure(conf) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fluent/plugin/in_rds_slowlog.rb', line 20

def configure(conf)
  super
  begin
    @client = Mysql2::Client.new({
      :host => @host,
      :port => @port,
      :username => @username,
      :password => @password,
      :database => 'mysql'
    })
  rescue
    log.error "fluent-plugin-rds-slowlog: cannot connect RDS"
  end
end

#shutdownObject



40
41
42
43
44
# File 'lib/fluent/plugin/in_rds_slowlog.rb', line 40

def shutdown
  super
  @watcher.terminate
  @watcher.join
end

#startObject



35
36
37
38
# File 'lib/fluent/plugin/in_rds_slowlog.rb', line 35

def start
  super
  @watcher = Thread.new(&method(:watch))
end