fluent-plugin-rds-slowlog 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -49,6 +49,14 @@ every 10 seconds from AWS RDS.
49
49
  2013-03-08T16:04:43+09:00 rds-slowlog {"start_time":"2013-03-08 07:04:38","user_host":"rds_db[rds_db] @ [192.0.2.10]","query_time":"00:00:00","lock_time":"00:00:00","rows_sent":"3000","rows_examined":"3000","db":"rds_db","last_insert_id":"0","insert_id":"0","server_id":"100000000","sql_text":"Quit"}
50
50
  ```
51
51
 
52
+ #### if not connect
53
+
54
+ - td-agent.log
55
+
56
+ ```
57
+ 2013-06-29 00:32:55 +0900 [error]: fluent-plugin-rds-slowlog: cannot connect RDS
58
+ ```
59
+
52
60
  ## TODO
53
61
 
54
62
  * more test test test
@@ -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-slowlog"
7
- gem.version = "0.0.1"
7
+ gem.version = "0.0.2"
8
8
  gem.authors = ["kenjiskywalker"]
9
9
  gem.email = ["git@kenjiskywalker.org"]
10
10
  gem.description = "Amazon RDS slow_log input plugin for Fluent event collector"
@@ -14,13 +14,17 @@ class Fluent::Rds_SlowlogInput < Fluent::Input
14
14
 
15
15
  def configure(conf)
16
16
  super
17
- @client = Mysql2::Client.new({
17
+ begin
18
+ @client = Mysql2::Client.new({
18
19
  :host => @host,
19
20
  :port => @port,
20
21
  :username => @username,
21
22
  :password => @password,
22
23
  :database => 'mysql'
23
24
  })
25
+ rescue
26
+ $log.error "fluent-plugin-rds-slowlog: cannot connect RDS"
27
+ end
24
28
  end
25
29
 
26
30
  def start
@@ -43,7 +47,7 @@ class Fluent::Rds_SlowlogInput < Fluent::Input
43
47
  end
44
48
 
45
49
  def output
46
- slow_log_data = {}
50
+ slow_log_data = []
47
51
  slow_log_data = @client.query('SELECT * FROM slow_log', :cast => false)
48
52
  @client.query('CALL mysql.rds_rotate_slow_log')
49
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-rds-slowlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-09 00:00:00.000000000 Z
12
+ date: 2013-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -86,3 +86,4 @@ summary: Amazon RDS slow_log input plugin for Fluent event collector
86
86
  test_files:
87
87
  - test/helper.rb
88
88
  - test/plugin/test_in_rds_slowlog.rb
89
+ has_rdoc: