Class: Fluent::Rds_GenlogInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Rds_GenlogInput
- Defined in:
- lib/fluent/plugin/in_rds_genlog.rb
Defined Under Namespace
Classes: TimerWatcher
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ Rds_GenlogInput
constructor
A new instance of Rds_GenlogInput.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ Rds_GenlogInput
Returns a new instance of Rds_GenlogInput.
24 25 26 27 |
# File 'lib/fluent/plugin/in_rds_genlog.rb', line 24 def initialize super require 'mysql2' end |
Instance Method Details
#configure(conf) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/fluent/plugin/in_rds_genlog.rb', line 29 def configure(conf) super begin @client = create_mysql_client rescue log.error "fluent-plugin-rds-genlog: cannot connect RDS" end end |
#shutdown ⇒ Object
50 51 52 53 54 |
# File 'lib/fluent/plugin/in_rds_genlog.rb', line 50 def shutdown super @watcher.terminate @watcher.join end |
#start ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fluent/plugin/in_rds_genlog.rb', line 38 def start super if @backup_table @client.query("CREATE TABLE IF NOT EXISTS #{@backup_table} LIKE general_log") end @loop = Coolio::Loop.new timer = TimerWatcher.new(@interval, true, log, &method(:output)) @loop.attach(timer) @watcher = Thread.new(&method(:watch)) end |