logstash-output-jdbc 5.2.1-java → 5.3.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/outputs/jdbc.rb +23 -7
- data/spec/jdbc_spec_helper.rb +2 -2
- data/spec/outputs/jdbc_derby_spec.rb +1 -1
- data/vendor/jar-dependencies/runtime-jars/HikariCP-2.7.2.jar +0 -0
- data/vendor/jar-dependencies/runtime-jars/{slf4j-api-1.7.22.jar → slf4j-api-1.7.25.jar} +0 -0
- metadata +38 -32
- data/vendor/jar-dependencies/runtime-jars/HikariCP-2.6.1.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93b219b0c6e3c8ee57f477661b7ab1004dc89524
|
4
|
+
data.tar.gz: 36b52632054abce4140ccc214dec0c06ed2c40eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b24bfcd75b6c3d8293a8df7dcd6979fa24b38781b99ca0b2c95a267e36f5bb21267741a0808c96237640882aa5f59c40a002bd02a90ae7ff890e7f4cb4b7c824
|
7
|
+
data.tar.gz: fc0521bc877e02532db6cbab5480f11eb9353ec2803f3327e51364dea2aa19e3108f6b519f2f9c05a4820ffc0a4c8ea1f28ffdf4fa8602e37107a09b486d7632
|
@@ -6,6 +6,7 @@ require 'stud/interval'
|
|
6
6
|
require 'java'
|
7
7
|
require 'logstash-output-jdbc_jars'
|
8
8
|
require 'json'
|
9
|
+
require 'bigdecimal'
|
9
10
|
|
10
11
|
# Write events to a SQL engine, using JDBC.
|
11
12
|
#
|
@@ -64,7 +65,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
64
65
|
config :unsafe_statement, validate: :boolean, default: false
|
65
66
|
|
66
67
|
# Number of connections in the pool to maintain
|
67
|
-
config :max_pool_size, validate: :number, default:
|
68
|
+
config :max_pool_size, validate: :number, default: 5
|
68
69
|
|
69
70
|
# Connection timeout
|
70
71
|
config :connection_timeout, validate: :number, default: 10000
|
@@ -99,6 +100,12 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
99
100
|
config :max_repeat_exceptions, obsolete: 'This has been replaced by max_flush_exceptions - which behaves slightly differently. Please check the documentation.'
|
100
101
|
config :max_repeat_exceptions_time, obsolete: 'This is no longer required'
|
101
102
|
config :idle_flush_time, obsolete: 'No longer necessary under Logstash v5'
|
103
|
+
|
104
|
+
# Allows the whole event to be converted to JSON
|
105
|
+
config :enable_event_as_json_keyword, validate: :boolean, default: false
|
106
|
+
|
107
|
+
# The magic key used to convert the whole event to JSON. If you need this, and you have the default in your events, you can use this to change your magic keyword.
|
108
|
+
config :event_as_json_keyword, validate: :string, default: '@event'
|
102
109
|
|
103
110
|
def register
|
104
111
|
@logger.info('JDBC - Starting up')
|
@@ -201,7 +208,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
201
208
|
begin
|
202
209
|
connection = @pool.getConnection
|
203
210
|
rescue => e
|
204
|
-
log_jdbc_exception(e, true)
|
211
|
+
log_jdbc_exception(e, true, nil)
|
205
212
|
# If a connection is not available, then the server has gone away
|
206
213
|
# We're not counting that towards our retry count.
|
207
214
|
return events, false
|
@@ -215,7 +222,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
215
222
|
statement = add_statement_event_params(statement, event) if @statement.length > 1
|
216
223
|
statement.execute
|
217
224
|
rescue => e
|
218
|
-
if retry_exception?(e)
|
225
|
+
if retry_exception?(e, event.to_json())
|
219
226
|
events_to_retry.push(event)
|
220
227
|
end
|
221
228
|
ensure
|
@@ -262,7 +269,9 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
262
269
|
|
263
270
|
def add_statement_event_params(statement, event)
|
264
271
|
@statement[1..-1].each_with_index do |i, idx|
|
265
|
-
if i.is_a? String
|
272
|
+
if @enable_event_as_json_keyword and i.is_a? String and i == @event_as_json_keyword
|
273
|
+
value = event.to_json
|
274
|
+
elsif i.is_a? String
|
266
275
|
value = event.get(i)
|
267
276
|
if value.nil? and i =~ /%\{/
|
268
277
|
value = event.sprintf(i)
|
@@ -290,6 +299,8 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
290
299
|
else
|
291
300
|
statement.setInt(idx + 1, value)
|
292
301
|
end
|
302
|
+
when BigDecimal
|
303
|
+
statement.setBigDecimal(idx + 1, value)
|
293
304
|
when Float
|
294
305
|
statement.setFloat(idx + 1, value)
|
295
306
|
when String
|
@@ -306,16 +317,21 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
306
317
|
statement
|
307
318
|
end
|
308
319
|
|
309
|
-
def retry_exception?(exception)
|
320
|
+
def retry_exception?(exception, event)
|
310
321
|
retrying = (exception.respond_to? 'getSQLState' and (RETRYABLE_SQLSTATE_CLASSES.include?(exception.getSQLState.to_s[0,2]) or @retry_sql_states.include?(exception.getSQLState)))
|
311
|
-
log_jdbc_exception(exception, retrying)
|
322
|
+
log_jdbc_exception(exception, retrying, event)
|
312
323
|
|
313
324
|
retrying
|
314
325
|
end
|
315
326
|
|
316
|
-
def log_jdbc_exception(exception, retrying)
|
327
|
+
def log_jdbc_exception(exception, retrying, event)
|
317
328
|
current_exception = exception
|
318
329
|
log_text = 'JDBC - Exception. ' + (retrying ? 'Retrying' : 'Not retrying') + '.'
|
330
|
+
|
331
|
+
if(event != nil)
|
332
|
+
log_text += ' event: "' + event + '".'
|
333
|
+
end
|
334
|
+
|
319
335
|
log_method = (retrying ? 'warn' : 'error')
|
320
336
|
|
321
337
|
loop do
|
data/spec/jdbc_spec_helper.rb
CHANGED
@@ -59,11 +59,11 @@ RSpec.shared_context 'when outputting messages' do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
let(:jdbc_create_table) do
|
62
|
-
"CREATE table #{jdbc_test_table} (created_at datetime not null, message varchar(512) not null, message_sprintf varchar(512) not null, static_int int not null, static_bit bit not null, static_bigint bigint not null)"
|
62
|
+
"CREATE table #{jdbc_test_table} (created_at datetime not null, message varchar(512) not null, message_sprintf varchar(512) not null, static_int int not null, static_bit bit not null, static_bigint bigint not null, static_float float not null)"
|
63
63
|
end
|
64
64
|
|
65
65
|
let(:jdbc_statement) do
|
66
|
-
["insert into #{jdbc_test_table} (created_at, message, message_sprintf, static_int, static_bit, static_bigint) values(?, ?, ?, ?, ?, ?)", '@timestamp', 'message', 'sprintf-%{message}', 1, true, 4000881632477184]
|
66
|
+
["insert into #{jdbc_test_table} (created_at, message, message_sprintf, static_int, static_bit, static_bigint, static_float) values(?, ?, ?, ?, ?, ?, ?)", '@timestamp', 'message', 'sprintf-%{message}', 1, true, 4000881632477184, 12.1]
|
67
67
|
end
|
68
68
|
|
69
69
|
let(:systemd_database_service) do
|
@@ -10,7 +10,7 @@ describe 'logstash-output-jdbc: derby', if: ENV['JDBC_DERBY_JAR'] do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
let(:jdbc_create_table) do
|
13
|
-
"CREATE table #{jdbc_test_table} (created_at timestamp not null, message varchar(512) not null, message_sprintf varchar(512) not null, static_int int not null, static_bit boolean not null, static_bigint bigint not null)"
|
13
|
+
"CREATE table #{jdbc_test_table} (created_at timestamp not null, message varchar(512) not null, message_sprintf varchar(512) not null, static_int int not null, static_bit boolean not null, static_bigint bigint not null, static_float float not null)"
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:jdbc_settings) do
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,113 +1,119 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-jdbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- the_angry_angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: logstash-core-plugin-api
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2'
|
20
14
|
requirement: !ruby/object:Gem::Requirement
|
21
15
|
requirements:
|
22
16
|
- - "~>"
|
23
17
|
- !ruby/object:Gem::Version
|
24
18
|
version: '2'
|
19
|
+
name: logstash-core-plugin-api
|
25
20
|
prerelease: false
|
26
21
|
type: :runtime
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: stud
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
|
-
- - "
|
24
|
+
- - "~>"
|
32
25
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
36
30
|
- - ">="
|
37
31
|
- !ruby/object:Gem::Version
|
38
32
|
version: '0'
|
33
|
+
name: stud
|
39
34
|
prerelease: false
|
40
35
|
type: :runtime
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: logstash-codec-plain
|
43
36
|
version_requirements: !ruby/object:Gem::Requirement
|
44
37
|
requirements:
|
45
38
|
- - ">="
|
46
39
|
- !ruby/object:Gem::Version
|
47
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
48
42
|
requirement: !ruby/object:Gem::Requirement
|
49
43
|
requirements:
|
50
44
|
- - ">="
|
51
45
|
- !ruby/object:Gem::Version
|
52
46
|
version: '0'
|
47
|
+
name: logstash-codec-plain
|
53
48
|
prerelease: false
|
54
49
|
type: :runtime
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: jar-dependencies
|
57
50
|
version_requirements: !ruby/object:Gem::Requirement
|
58
51
|
requirements:
|
59
52
|
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
62
56
|
requirement: !ruby/object:Gem::Requirement
|
63
57
|
requirements:
|
64
58
|
- - ">="
|
65
59
|
- !ruby/object:Gem::Version
|
66
60
|
version: '0'
|
61
|
+
name: jar-dependencies
|
67
62
|
prerelease: false
|
68
63
|
type: :development
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: ruby-maven
|
71
64
|
version_requirements: !ruby/object:Gem::Requirement
|
72
65
|
requirements:
|
73
|
-
- - "
|
66
|
+
- - ">="
|
74
67
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
76
70
|
requirement: !ruby/object:Gem::Requirement
|
77
71
|
requirements:
|
78
72
|
- - "~>"
|
79
73
|
- !ruby/object:Gem::Version
|
80
74
|
version: '3.3'
|
75
|
+
name: ruby-maven
|
81
76
|
prerelease: false
|
82
77
|
type: :development
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: logstash-devutils
|
85
78
|
version_requirements: !ruby/object:Gem::Requirement
|
86
79
|
requirements:
|
87
|
-
- - "
|
80
|
+
- - "~>"
|
88
81
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
82
|
+
version: '3.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
90
84
|
requirement: !ruby/object:Gem::Requirement
|
91
85
|
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.3'
|
92
89
|
- - ">="
|
93
90
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
91
|
+
version: 1.3.1
|
92
|
+
name: logstash-devutils
|
95
93
|
prerelease: false
|
96
94
|
type: :development
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop
|
99
95
|
version_requirements: !ruby/object:Gem::Requirement
|
100
96
|
requirements:
|
101
|
-
- -
|
97
|
+
- - "~>"
|
102
98
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
99
|
+
version: '1.3'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.3.1
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - '='
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: 0.41.2
|
109
|
+
name: rubocop
|
109
110
|
prerelease: false
|
110
111
|
type: :development
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.41.2
|
111
117
|
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install 'logstash-output-jdbc'. This gem is not a stand-alone program
|
112
118
|
email: karl+github@theangryangel.co.uk
|
113
119
|
executables: []
|
@@ -123,10 +129,10 @@ files:
|
|
123
129
|
- spec/outputs/jdbc_mysql_spec.rb
|
124
130
|
- spec/outputs/jdbc_spec.rb
|
125
131
|
- spec/outputs/jdbc_sqlite_spec.rb
|
126
|
-
- vendor/jar-dependencies/runtime-jars/HikariCP-2.
|
132
|
+
- vendor/jar-dependencies/runtime-jars/HikariCP-2.7.2.jar
|
127
133
|
- vendor/jar-dependencies/runtime-jars/log4j-api-2.6.2.jar
|
128
134
|
- vendor/jar-dependencies/runtime-jars/log4j-slf4j-impl-2.6.2.jar
|
129
|
-
- vendor/jar-dependencies/runtime-jars/slf4j-api-1.7.
|
135
|
+
- vendor/jar-dependencies/runtime-jars/slf4j-api-1.7.25.jar
|
130
136
|
homepage: https://github.com/theangryangel/logstash-output-jdbc
|
131
137
|
licenses:
|
132
138
|
- Apache License (2.0)
|
@@ -148,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
154
|
- !ruby/object:Gem::Version
|
149
155
|
version: '0'
|
150
156
|
requirements:
|
151
|
-
- jar 'com.zaxxer:HikariCP', '2.
|
157
|
+
- jar 'com.zaxxer:HikariCP', '2.7.2'
|
152
158
|
- jar 'org.apache.logging.log4j:log4j-slf4j-impl', '2.6.2'
|
153
159
|
rubyforge_project:
|
154
160
|
rubygems_version: 2.4.8
|
Binary file
|