fluent-plugin-mysql 0.3.0 → 0.3.1
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 -0
- data/fluent-plugin-mysql.gemspec +2 -1
- data/lib/fluent/plugin/out_mysql_bulk.rb +6 -2
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd20dacbc16ec2775c29cc44c63e14010f146860
|
4
|
+
data.tar.gz: 6dab2e2756ca7eeaae7088c6683f0bbab18a908c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5419d8d9fc5e4a55971aec6d2559db430130fb5053aba7b61f52c6325be1c3b7464162a7cbcf94e860c97d423c8eaf6b03c3eb6ec7d5ac8c8541c4205f0c7449
|
7
|
+
data.tar.gz: fd3b05f072be6377d7f80c97d841d84515bcb64f996d00ad04b6848dee163355d2129a866a87259f79f0d7424929749b54d1f2d942b4a7997d1719d1c36c4a82
|
data/README.md
CHANGED
@@ -28,6 +28,7 @@ sslverify|verify server certificate(default: nil)
|
|
28
28
|
column_names|bulk insert column (require)
|
29
29
|
key_names|value key names, ${time} is placeholder Time.at(time).strftime("%Y-%m-%d %H:%M:%S") (default : column_names)
|
30
30
|
json_key_names|Key names which store data as json, comma separator.
|
31
|
+
unixtimestamp_key_names|Key names which store data as datetime from unix time stamp
|
31
32
|
table|bulk insert table (require)
|
32
33
|
on_duplicate_key_update|on duplicate key update enable (true:false)
|
33
34
|
on_duplicate_update_keys|on duplicate key update column, comma separator
|
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.3.
|
4
|
+
gem.version = "0.3.1"
|
5
5
|
gem.authors = ["TAGOMORI Satoshi", "Toyama Hiroshi"]
|
6
6
|
gem.email = ["tagomoris@gmail.com", "toyama0919@gmail.com"]
|
7
7
|
gem.description = %q{fluent plugin to insert mysql as json(single column) or insert statement}
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.add_runtime_dependency "fluentd", ['>= 0.14.8', '< 2']
|
18
18
|
gem.add_runtime_dependency "mysql2-cs-bind"
|
19
19
|
gem.add_runtime_dependency "jsonpath"
|
20
|
+
gem.add_runtime_dependency "oj"
|
20
21
|
gem.add_development_dependency "rake"
|
21
22
|
gem.add_development_dependency "test-unit"
|
22
23
|
gem.add_development_dependency "timecop", "~> 0.8.0"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fluent/plugin/output'
|
2
|
+
require 'oj'
|
2
3
|
|
3
4
|
module Fluent::Plugin
|
4
5
|
class MysqlBulkOutput < Output
|
@@ -101,7 +102,8 @@ DESC
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def check_table_schema(database: @database, table: @table)
|
104
|
-
|
105
|
+
_client = client(database)
|
106
|
+
result = _client.xquery("SHOW COLUMNS FROM #{table}")
|
105
107
|
max_lengths = []
|
106
108
|
@column_names.each do |column|
|
107
109
|
info = result.select { |x| x['Field'] == column }.first
|
@@ -114,6 +116,8 @@ DESC
|
|
114
116
|
max_lengths << max_length
|
115
117
|
end
|
116
118
|
max_lengths
|
119
|
+
ensure
|
120
|
+
_client.close
|
117
121
|
end
|
118
122
|
|
119
123
|
def format(tag, time, record)
|
@@ -186,7 +190,7 @@ DESC
|
|
186
190
|
end
|
187
191
|
|
188
192
|
if @json_key_names && @json_key_names.include?(key)
|
189
|
-
value = value
|
193
|
+
value = Oj.dump(value)
|
190
194
|
end
|
191
195
|
|
192
196
|
if @unixtimestamp_key_names && @unixtimestamp_key_names.include?(key)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
@@ -59,6 +59,20 @@ dependencies:
|
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: oj
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
type: :runtime
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
62
76
|
- !ruby/object:Gem::Dependency
|
63
77
|
name: rake
|
64
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
156
|
version: '0'
|
143
157
|
requirements: []
|
144
158
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.6.
|
159
|
+
rubygems_version: 2.6.8
|
146
160
|
signing_key:
|
147
161
|
specification_version: 4
|
148
162
|
summary: fluent plugin to insert mysql
|