fluent-plugin-mysql 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/fluent-plugin-mysql.gemspec +1 -1
- data/lib/fluent/plugin/out_mysql.rb +8 -3
- data/test/plugin/test_out_mysql.rb +15 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed6ee3d9d928c77a83045aa743632071d1958f2c
|
4
|
+
data.tar.gz: 8253b438fe433e276e0cb1b1d25b418f9356af17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc6213f47a64d9e9572d2bc61d606861f1d0fcc8b02e89106ee679898222cf886f272bc4e39310389b621cec1b861eb539320c2d7dec573f36c576f7e48f58d8
|
7
|
+
data.tar.gz: d31c3e4bf58cbc09c9cf0594d5b709177fafbee11464ec3d6d3fce91234a009c694374b13f1c77c022f48fdb83659ca5855afd038449e677599f67610521bae4
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
### MysqlOutput
|
6
6
|
|
7
|
-
|
7
|
+
[Fluentd](http://fluentd.org) plugin to store mysql tables over SQL, to each columns per values, or to single column as json.
|
8
8
|
|
9
9
|
## Configuration
|
10
10
|
|
data/fluent-plugin-mysql.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = "fluent-plugin-mysql"
|
4
|
-
gem.version = "0.0.
|
4
|
+
gem.version = "0.0.7"
|
5
5
|
gem.authors = ["TAGOMORI Satoshi"]
|
6
6
|
gem.email = ["tagomoris@gmail.com"]
|
7
7
|
gem.description = %q{fluent plugin to insert mysql as json(single column) or insert statement}
|
@@ -25,6 +25,11 @@ class Fluent::MysqlOutput < Fluent::BufferedOutput
|
|
25
25
|
require 'jsonpath'
|
26
26
|
end
|
27
27
|
|
28
|
+
# Define `log` method for v0.10.42 or earlier
|
29
|
+
unless method_defined?(:log)
|
30
|
+
define_method("log") { $log }
|
31
|
+
end
|
32
|
+
|
28
33
|
def configure(conf)
|
29
34
|
super
|
30
35
|
|
@@ -34,7 +39,7 @@ class Fluent::MysqlOutput < Fluent::BufferedOutput
|
|
34
39
|
when 'json'
|
35
40
|
@format_proc = Proc.new{|tag, time, record| record.to_json}
|
36
41
|
when 'jsonpath'
|
37
|
-
@key_names = @key_names.split(
|
42
|
+
@key_names = @key_names.split(/\s*,\s*/)
|
38
43
|
@format_proc = Proc.new do |tag, time, record|
|
39
44
|
json = record.to_json
|
40
45
|
@key_names.map do |k|
|
@@ -42,7 +47,7 @@ class Fluent::MysqlOutput < Fluent::BufferedOutput
|
|
42
47
|
end
|
43
48
|
end
|
44
49
|
else
|
45
|
-
@key_names = @key_names.split(
|
50
|
+
@key_names = @key_names.split(/\s*,\s*/)
|
46
51
|
@format_proc = Proc.new{|tag, time, record| @key_names.map{|k| record[k]}}
|
47
52
|
end
|
48
53
|
|
@@ -65,7 +70,7 @@ class Fluent::MysqlOutput < Fluent::BufferedOutput
|
|
65
70
|
end
|
66
71
|
else # columns
|
67
72
|
raise Fluent::ConfigError, "table missing" unless @table
|
68
|
-
@columns = @columns.split(
|
73
|
+
@columns = @columns.split(/\s*,\s*/)
|
69
74
|
cols = @columns.join(',')
|
70
75
|
placeholders = if @format == 'json'
|
71
76
|
'?'
|
@@ -52,8 +52,20 @@ username bar
|
|
52
52
|
password mogera
|
53
53
|
key_names field1,field2,field3
|
54
54
|
table baz
|
55
|
-
columns col1,col2,col3
|
55
|
+
columns col1, col2 ,col3
|
56
56
|
]
|
57
|
+
assert_equal ['field1', 'field2', 'field3'], d.instance.key_names
|
58
|
+
assert_equal 'INSERT INTO baz (col1,col2,col3) VALUES (?,?,?)', d.instance.sql
|
59
|
+
d = create_driver %[
|
60
|
+
host database.local
|
61
|
+
database foo
|
62
|
+
username bar
|
63
|
+
password mogera
|
64
|
+
key_names field1 ,field2, field3
|
65
|
+
table baz
|
66
|
+
columns col1, col2 ,col3
|
67
|
+
]
|
68
|
+
assert_equal ['field1', 'field2', 'field3'], d.instance.key_names
|
57
69
|
assert_equal 'INSERT INTO baz (col1,col2,col3) VALUES (?,?,?)', d.instance.sql
|
58
70
|
|
59
71
|
assert_raise(Fluent::ConfigError) {
|
@@ -66,6 +78,8 @@ key_names field1,field2,field3
|
|
66
78
|
sql INSERT INTO baz (col1,col2,col3,col4) VALUES (?,?,?,?)
|
67
79
|
]
|
68
80
|
}
|
81
|
+
|
82
|
+
|
69
83
|
end
|
70
84
|
|
71
85
|
def test_format
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mysql2-cs-bind
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: jsonpath
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: fluent plugin to insert mysql as json(single column) or insert statement
|
@@ -73,7 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
77
77
|
- Gemfile
|
78
78
|
- LICENSE.txt
|
79
79
|
- README.md
|
@@ -92,21 +92,20 @@ require_paths:
|
|
92
92
|
- lib
|
93
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.2.2
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: fluent plugin to insert mysql
|
109
109
|
test_files:
|
110
110
|
- test/helper.rb
|
111
111
|
- test/plugin/test_out_mysql.rb
|
112
|
-
has_rdoc:
|