fluent-plugin-mysqlslowquerylog-ippen-digital 0.0.4 → 0.0.5
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.
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "fluent-plugin-mysqlslowquerylog-ippen-digital"
|
5
|
-
gem.version = "0.0.
|
5
|
+
gem.version = "0.0.5"
|
6
6
|
gem.authors = ["Satoshi SUZUKI", "Gerhard Strauss"]
|
7
7
|
gem.email = ["studio3104.com@gmail.com", "gerhard.strauss@ippen-digital.de"]
|
8
8
|
gem.description = %q{Fluentd plugin to concat MySQL slowquerylog.}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Fluent::MySQLSlowQueryLogOutput < Fluent::Output
|
2
2
|
Fluent::Plugin.register_output('mysqlslowquerylog', self)
|
3
3
|
include Fluent::HandleTagNameMixin
|
4
|
+
require 'digest'
|
4
5
|
|
5
6
|
def configure(conf)
|
6
7
|
super
|
@@ -61,6 +62,7 @@ class Fluent::MySQLSlowQueryLogOutput < Fluent::Output
|
|
61
62
|
message =~ REGEX1
|
62
63
|
record['user'] = $1
|
63
64
|
record['host'] = $2
|
65
|
+
@hash_str = record['user'].to_s + record['host'].to_s
|
64
66
|
message = @slowlogs[:"#{tag}"].shift
|
65
67
|
|
66
68
|
message =~ REGEX2
|
@@ -81,9 +83,15 @@ class Fluent::MySQLSlowQueryLogOutput < Fluent::Output
|
|
81
83
|
if message.start_with?('SET timestamp=')
|
82
84
|
message =~ REGEX4
|
83
85
|
record['set_timestamp'] = $1
|
86
|
+
@hash_str << record['set_timestamp'].to_s
|
84
87
|
end
|
85
88
|
|
86
|
-
|
89
|
+
@sql_line = @slowlogs[:"#{tag}"].map {|m| m.strip}.join(' ')
|
90
|
+
record['sql'] = @sql_line.to_s
|
91
|
+
@hash_str << @sql_line.to_s
|
92
|
+
|
93
|
+
record['hash_source'] = @hash_str
|
94
|
+
record['hash_id'] = Digest::SHA1.hexdigest(@hash_str)
|
87
95
|
|
88
96
|
time = date.to_i if date
|
89
97
|
flush_emit(tag, time, record)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mysqlslowquerylog-ippen-digital
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-01-
|
13
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|