fluent-plugin-rds-log 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/fluent-plugin-rds-log.gemspec +1 -1
- data/lib/fluent/plugin/in_rds_log.rb +24 -12
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e09e5f921b755de90de08e2ec681fa267890c87d
|
|
4
|
+
data.tar.gz: 7092cd06d100b40f961a7df30f28dae565658a7c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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.
|
|
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-
|
|
11
|
+
date: 2013-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fluentd
|