fluent-plugin-rds-mysql-slow-log 0.1.0 → 0.2.0

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: 36fa45a004f050662ff15c1873fd7293f357eca0
4
- data.tar.gz: 2f213f061c22154b832206bddfc202c08a1afd0c
3
+ metadata.gz: 565605f86cec00568451e93b04477c06b39fa2a1
4
+ data.tar.gz: 8df2f6f5be0e42f8581f93da60fc5b2dd013d797
5
5
  SHA512:
6
- metadata.gz: 16a03a50674bf7eed453d223af75257a4409c188ed65b9d7d1692892949823d0919559dc012c6f33c9984a106b868c1eba1dd22e3056da6e1a5cba2600eb6fb7
7
- data.tar.gz: ecef8575d6ce05d0e7782199feb89e4b01eae80469775d8f633b88cc545d2ebeee3398f943e573cc84aa1d159e07fe85333a909da0f2785e040dd2033f75e482
6
+ metadata.gz: d673c80ab5c6c3e4496e31719f0dccc6bb67c723b729376b647f455b7a8a1c36dcb11a5f78af5986250de4b53275e9c3c587d261ed00ae9b150caa29ab5b0eb6
7
+ data.tar.gz: bbfae2a34b504d8ef866ad18955ec792600275d60d4f35354858bb488ce86e997489a9d322a70f9e8b7df0e5ecb77934352af7bacc12a6306c3ba32d1a1659fd
data/README.md CHANGED
@@ -32,6 +32,7 @@ Or install it yourself as:
32
32
  from_encoding shift_jis
33
33
  keep_time_key
34
34
  null_empty_string
35
+ rotate_interval 1
35
36
  tag_prefix slow_log
36
37
  <server>
37
38
  host db1.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com
@@ -63,3 +64,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/kaorim
63
64
  ## License
64
65
 
65
66
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
67
+
68
+ ## Acknowledgement
69
+
70
+ The idea of calling `mysql.rds_rotate_slow_log` for collecting slow log entries is borrowed from [fluent-plugin-rds-slowlog](https://github.com/kenjiskywalker/fluent-plugin-rds-slowlog).
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'fluent-plugin-rds-mysql-slow-log'
8
- spec.version = '0.1.0'
8
+ spec.version = '0.2.0'
9
9
  spec.authors = ['Satoshi Matsumoto']
10
10
  spec.email = ['kaorimatz@gmail.com']
11
11
 
@@ -9,11 +9,12 @@ module Fluent
9
9
  Plugin.register_input('rds_mysql_slow_log', self)
10
10
 
11
11
  config_param :database_timezone, :string, default: nil, desc: 'The timezone of the database.'
12
- config_param :emit_interval, :time, default: 10, desc: 'The interval in seconds to emit records.'
12
+ config_param :emit_interval, :time, default: 60, desc: 'The interval in seconds to emit records.'
13
13
  config_param :encoding, :string, default: nil, desc: 'The encoding of strings in an emitted record.'
14
14
  config_param :from_encoding, :string, default: nil, desc: 'The encoding of sql_text data.'
15
15
  config_param :keep_time_key, :bool, default: false, desc: 'Keep the time key in an emitted record.'
16
16
  config_param :null_empty_string, :bool, default: false, desc: 'Convert empty strings to null.'
17
+ config_param :rotate_interval, :time, default: nil, desc: 'The interval in seconds between subsequent rotations of slow_log tables across servers.'
17
18
  config_param :tag_prefix, :string, default: nil, desc: 'The prefix of the tag.'
18
19
  config_section :server, param_name: :servers, required: true do
19
20
  config_param :host, :string, desc: 'The IP address or hostname of the server.'
@@ -80,7 +81,8 @@ module Fluent
80
81
  end
81
82
 
82
83
  def on_timer
83
- @servers.each do |tag, server|
84
+ @servers.each.with_index do |(tag, server), i|
85
+ sleep @rotate_interval if @rotate_interval && !i.nonzero?
84
86
  emit_slow_log(tag, server)
85
87
  end
86
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-rds-mysql-slow-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-14 00:00:00.000000000 Z
11
+ date: 2017-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd