logstash-output-jdbc 0.2.5 → 0.2.6.rc1
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 +4 -4
- data/README.md +5 -2
- data/lib/logstash/outputs/jdbc.rb +29 -30
- data/spec/outputs/jdbc_spec.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7ca2b9a39fb1b59ff36a652c34d078479379478
|
4
|
+
data.tar.gz: e856cfc5cd4b226eadd2a371b6a8cb87bbeaac9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61431d233a16c533f11b19f439d0a71d8df67effc839dd9b2df9841e2a83de708f6c766eb32bd81f58525011c7179f31fe4ab0ba80468ff7b63607820bb3b5ff
|
7
|
+
data.tar.gz: ff99288699de683e16d8511220e5e28341c695a94068ff0772825ba54e72c003d261645e7301209665c1250bd6d6e19be4ec7987eaee2fa7888387f67fc36a9f
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
# logstash-output-jdbc
|
1
|
+
# logstash-output-jdbc
|
2
|
+
|
3
|
+
[](https://travis-ci.org/theangryangel/logstash-output-jdbc)
|
4
|
+
|
2
5
|
This plugin is provided as an external plugin and is not part of the Logstash project.
|
3
6
|
|
4
7
|
This plugin allows you to output to SQL databases, using JDBC adapters.
|
@@ -6,7 +9,7 @@ See below for tested adapters, and example configurations.
|
|
6
9
|
|
7
10
|
This has not yet been extensively tested with all JDBC drivers and may not yet work for you.
|
8
11
|
|
9
|
-
If you do find this works for a JDBC driver
|
12
|
+
If you do find this works for a JDBC driver without an example, let me know and provide a small example configuration if you can.
|
10
13
|
|
11
14
|
This plugin does not bundle any JDBC jar files, and does expect them to be in a
|
12
15
|
particular location. Please ensure you read the 4 installation lines below.
|
@@ -98,7 +98,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
98
98
|
end
|
99
99
|
|
100
100
|
setup_and_test_pool!
|
101
|
-
|
101
|
+
|
102
102
|
buffer_initialize(
|
103
103
|
:max_items => @flush_size,
|
104
104
|
:max_interval => @idle_flush_time,
|
@@ -194,56 +194,55 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
|
194
194
|
end
|
195
195
|
|
196
196
|
def safe_flush(events, teardown=false)
|
197
|
-
connection =
|
198
|
-
statement =
|
197
|
+
connection = nil
|
198
|
+
statement = nil
|
199
|
+
begin
|
200
|
+
connection = @pool.getConnection()
|
201
|
+
statement = connection.prepareStatement(@statement[0])
|
199
202
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
203
|
+
events.each do |event|
|
204
|
+
next if event.cancelled?
|
205
|
+
next if @statement.length < 2
|
206
|
+
statement = add_statement_event_params(statement, event)
|
204
207
|
|
205
|
-
|
206
|
-
|
208
|
+
statement.addBatch()
|
209
|
+
end
|
207
210
|
|
208
|
-
begin
|
209
211
|
statement.executeBatch()
|
210
212
|
statement.close()
|
211
213
|
@exceptions_tracker << nil
|
212
|
-
|
213
214
|
rescue => e
|
214
|
-
# Raising an exception will incur a retry from Stud::Buffer.
|
215
|
-
# Since the exceutebatch failed this should mean any events failed to be
|
216
|
-
# inserted will be re-run. We're going to log it for the lols anyway.
|
217
215
|
log_jdbc_exception(e)
|
218
216
|
ensure
|
219
|
-
|
217
|
+
statement.close() unless statement.nil?
|
218
|
+
connection.close() unless connection.nil?
|
220
219
|
end
|
221
220
|
end
|
222
221
|
|
223
222
|
def unsafe_flush(events, teardown=false)
|
224
|
-
connection =
|
223
|
+
connection = nil
|
224
|
+
statement = nil
|
225
|
+
begin
|
226
|
+
connection = @pool.getConnection()
|
225
227
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
228
|
+
events.each do |event|
|
229
|
+
next if event.cancelled?
|
230
|
+
|
231
|
+
statement = connection.prepareStatement(event.sprintf(@statement[0]))
|
232
|
+
statement = add_statement_event_params(statement, event) if @statement.length > 1
|
231
233
|
|
232
|
-
begin
|
233
234
|
statement.execute()
|
234
|
-
|
235
|
+
|
235
236
|
# cancel the event, since we may end up outputting the same event multiple times
|
236
237
|
# if an exception happens later down the line
|
237
238
|
event.cancel
|
238
239
|
@exceptions_tracker << nil
|
239
|
-
rescue => e
|
240
|
-
# Raising an exception will incur a retry from Stud::Buffer.
|
241
|
-
# We log for the lols.
|
242
|
-
log_jdbc_exception(e)
|
243
|
-
ensure
|
244
|
-
statement.close()
|
245
|
-
connection.close()
|
246
240
|
end
|
241
|
+
rescue => e
|
242
|
+
log_jdbc_exception(e)
|
243
|
+
ensure
|
244
|
+
statement.close() unless statement.nil?
|
245
|
+
connection.close() unless connection.nil?
|
247
246
|
end
|
248
247
|
end
|
249
248
|
|
data/spec/outputs/jdbc_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-jdbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- the_angry_angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|
@@ -107,9 +107,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - '
|
110
|
+
- - '>'
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 1.3.1
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
115
|
rubygems_version: 2.0.14.1
|