fluent-plugin-mysql 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6779a8acd14cbc9c3506aad17847d6bf805b1ba5
4
- data.tar.gz: b399a06594b6957f4ca308f7fb8c088bf5906835
3
+ metadata.gz: 46b2ab27b2b88e54ba4f7ca82307f817d62ec94e
4
+ data.tar.gz: 402da207e1091d937b39c8e6d64d19f7b44183a5
5
5
  SHA512:
6
- metadata.gz: 53792258fcb40362c7cb913fdac21cd1c6e69db6141120c190b2eda54765542eb72259c062f5f9b10a4beff04a832715fb74e9a4cd4f2003f6931066bb763276
7
- data.tar.gz: e02269391bf5bbf7ee5b3a27299583ad9b19bf08ef5f75e956567f48997c16f8cd5921a8bc7b8facb0dda24fa21418e2fe214bf6595d2d0116b13c448739563d
6
+ metadata.gz: f32a22df72c4b9bb20167e3cf0f9b803c04b579185675fe7820face0ddb4bfe00d7c97dfc43500d1979ee07fd6b181deb055136ea4422b295c75f1515840a768
7
+ data.tar.gz: 32d688f19e937d51943db69c85e643955810d160d02f4e2490911efb41a60833e9f3d239816af4af824a5a5d918d8bcb33c58f17745d69794e4a8da70539f66d
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1
6
+ - 2.2.3
7
+ - 2.3.0
8
+
9
+ gemfile:
10
+ - Gemfile
11
+
12
+ before_install:
13
+ - gem update bundler
14
+
15
+ script: 'bundle exec rake test'
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # fluent-plugin-mysql, a plugin for [Fluentd](http://fluentd.org)
2
+ # fluent-plugin-mysql, a plugin for [Fluentd](http://fluentd.org) [![Build Status](https://secure.travis-ci.org/tagomoris/fluent-plugin-mysql.png?branch=master)](http://travis-ci.org/tagomoris/fluent-plugin-mysql)
3
3
 
4
4
  fluent plugin mysql bulk insert is high performance and on duplicate key update respond.
5
5
 
@@ -142,7 +142,90 @@ then result becomes as below (indented):
142
142
  +-----+-----------+---------------------+---------------------+
143
143
  ```
144
144
 
145
+ ## Configuration Example(bulk insert, time complement)
145
146
 
147
+ ```
148
+ <match mysql.input>
149
+ @type mysql_bulk
150
+ host localhost
151
+ database test_app_development
152
+ username root
153
+ password hogehoge
154
+ column_names id,user_name,created_at
155
+ key_names id,user,${time}
156
+ table users
157
+ flush_interval 10s
158
+ </match>
159
+ ```
160
+
161
+ Assume following input is coming:
162
+
163
+ ```js
164
+ 2014-01-03 21:35:15+09:00: mysql.input: {"user":"toyama","dummy":"hogehoge"}
165
+ 2014-01-03 21:35:21+09:00: mysql.input: {"user":"toyama2","dummy":"hogehoge"}
166
+ 2014-01-03 21:35:27+09:00: mysql.input: {"user":"toyama3","dummy":"hogehoge"}
167
+ ```
168
+
169
+ then `created_at` column is set from time attribute in a fluentd packet:
170
+
171
+ ```sql
172
+ +-----+-----------+---------------------+
173
+ | id | user_name | created_at |
174
+ +-----+-----------+---------------------+
175
+ | 1 | toyama | 2014-01-03 21:35:15 |
176
+ | 2 | toyama2 | 2014-01-03 21:35:21 |
177
+ | 3 | toyama3 | 2014-01-03 21:35:27 |
178
+ +-----+-----------+---------------------+
179
+ ```
180
+
181
+ ## Configuration Example(bulk insert, time complement with specific timezone)
182
+
183
+ As described above, `${time}` placeholder sets time with `Time.at(time).strftime("%Y-%m-%d %H:%M:%S")`.
184
+ This handles the time with fluentd server default timezone.
185
+ If you want to use the specific timezone, you can use the include_time_key feature.
186
+ This is useful in case fluentd server and mysql have different timezone.
187
+ You can use various timezone format. See below.
188
+ http://docs.fluentd.org/articles/formatter-plugin-overview
189
+
190
+ ```
191
+ <match mysql.input>
192
+ @type mysql_bulk
193
+ host localhost
194
+ database test_app_development
195
+ username root
196
+ password hogehoge
197
+
198
+ include_time_key yes
199
+ timezone +00
200
+ time_format %Y-%m-%d %H:%M:%S
201
+ time_key created_at
202
+
203
+ column_names id,user_name,created_at
204
+ key_names id,user,created_at
205
+ table users
206
+ flush_interval 10s
207
+ </match>
208
+ ```
209
+
210
+ Assume following input is coming(fluentd server is using JST +09 timezone):
211
+
212
+ ```js
213
+ 2014-01-03 21:35:15+09:00: mysql.input: {"user":"toyama","dummy":"hogehoge"}
214
+ 2014-01-03 21:35:21+09:00: mysql.input: {"user":"toyama2","dummy":"hogehoge"}
215
+ 2014-01-03 21:35:27+09:00: mysql.input: {"user":"toyama3","dummy":"hogehoge"}
216
+ ```
217
+
218
+ then `created_at` column is set from time attribute in a fluentd packet with timezone converted to +00 UTC:
219
+
220
+ ```sql
221
+ +-----+-----------+---------------------+
222
+ | id | user_name | created_at |
223
+ +-----+-----------+---------------------+
224
+ | 1 | toyama | 2014-01-03 12:35:15 |
225
+ | 2 | toyama2 | 2014-01-03 12:35:21 |
226
+ | 3 | toyama3 | 2014-01-03 12:35:27 |
227
+ +-----+-----------+---------------------+
228
+ ```
146
229
 
147
230
 
148
231
  ## spec
@@ -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.1.1"
4
+ gem.version = "0.1.2"
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}
@@ -3,6 +3,8 @@ module Fluent
3
3
  class Fluent::MysqlBulkOutput < Fluent::BufferedOutput
4
4
  Fluent::Plugin.register_output('mysql_bulk', self)
5
5
 
6
+ include Fluent::SetTimeKeyMixin
7
+
6
8
  config_param :host, :string, default: '127.0.0.1',
7
9
  :desc => "Database host."
8
10
  config_param :port, :integer, default: 3306,
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.1.1
4
+ version: 0.1.2
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: 2016-03-09 00:00:00.000000000 Z
12
+ date: 2016-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -90,6 +90,7 @@ extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
92
  - ".gitignore"
93
+ - ".travis.yml"
93
94
  - Gemfile
94
95
  - LICENSE.txt
95
96
  - README.md