fluent-plugin-rds-log 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: add7fe7d9021a5a7d4dae64dea124725af3b0b4a
4
- data.tar.gz: e6e8958fdb5837610abf43b0e49a684ae2fb6565
3
+ metadata.gz: e09e5f921b755de90de08e2ec681fa267890c87d
4
+ data.tar.gz: 7092cd06d100b40f961a7df30f28dae565658a7c
5
5
  SHA512:
6
- metadata.gz: a77f306f367f59f9b203c5af0563db50226a99f408b54514cb9e7bfdc9071f6e6117dfada0e11d4d92da66ddd1a5a90fe9639f87590e64246cc3273ab7dbd0f1
7
- data.tar.gz: 1bbd23d82fe88d25e0fd18aba7f1c2b8537bce8f22b7a4e262406824849503fb5b2c43828b7f23b14e9cbe20b4e4cc413e0f54080dea029e7d1911ccb70eed95
6
+ metadata.gz: bcc594b7aa25171c88e3eb99d3cd52b4a57ee2bad1bb8c71ca23bec3ad560ca98af35d035d200895743d195c3d0deae1804885fbdfadb2c346e7cb35c8fcab90
7
+ data.tar.gz: e1df1249f8398e9585e5e895fd7ef20f4b1dfb70fca9caab9757c676030629b9e52f19df6b0a223e031d33cf994a40a66f787f6c698d37effcfef2abec07f518
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "fluent-plugin-rds-log"
7
- gem.version = "0.1.2"
7
+ gem.version = "0.1.3"
8
8
  gem.authors = ["shinsaka"]
9
9
  gem.email = ["shinx1265@gmail.com"]
10
10
  gem.description = "Amazon RDS slow_log and general_log input plugin for Fluent event collector"
@@ -20,18 +20,6 @@ class Fluent::Rds_LogInput < Fluent::Input
20
20
  if @log_type.empty?
21
21
  $log.error "fluent-plugin-rds-log: missing parameter log_type is {slow_log|general_log}"
22
22
  end
23
- begin
24
- @client = Mysql2::Client.new({
25
- :host => @host,
26
- :port => @port,
27
- :username => @username,
28
- :password => @password,
29
- :reconnect => @auto_reconnect,
30
- :database => 'mysql'
31
- })
32
- rescue
33
- $log.error "fluent-plugin-rds-log: cannot connect RDS"
34
- end
35
23
  end
36
24
 
37
25
  def start
@@ -46,7 +34,24 @@ class Fluent::Rds_LogInput < Fluent::Input
46
34
  end
47
35
 
48
36
  private
37
+ def connect
38
+ begin
39
+ $log.info "fluent-plugin-rds-log: connecting RDS"
40
+ @client = Mysql2::Client.new({
41
+ :host => @host,
42
+ :port => @port,
43
+ :username => @username,
44
+ :password => @password,
45
+ :reconnect => @auto_reconnect,
46
+ :database => 'mysql'
47
+ })
48
+ $log.info "fluent-plugin-rds-log: connected RDS"
49
+ rescue
50
+ $log.error "fluent-plugin-rds-log: cannot connect RDS"
51
+ end
52
+ end
49
53
  def watch
54
+ connect
50
55
  while true
51
56
  sleep @refresh_interval
52
57
  output
@@ -54,6 +59,13 @@ class Fluent::Rds_LogInput < Fluent::Input
54
59
  end
55
60
 
56
61
  def output
62
+ if @client.nil?
63
+ connect
64
+ if @client.nil?
65
+ return
66
+ end
67
+ end
68
+
57
69
  @client.query("CALL mysql.rds_rotate_#{@log_type}")
58
70
 
59
71
  output_log_data = @client.query("SELECT * FROM mysql.#{@log_type}_backup", :cast => false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-rds-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - shinsaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-13 00:00:00.000000000 Z
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd