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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42579f38d0761b8192520ef41f03c42d501b139a
4
- data.tar.gz: 1ef31995f6535109cf5caedb1c91a8a90aac6c25
3
+ metadata.gz: d7ca2b9a39fb1b59ff36a652c34d078479379478
4
+ data.tar.gz: e856cfc5cd4b226eadd2a371b6a8cb87bbeaac9d
5
5
  SHA512:
6
- metadata.gz: 84a86a3afda777d90da998f4b37eebcb7a64bd8704dbc44b7084764d3dba29009506468d107ecd3c6069014da887581369fb1faf714a39572dd8dabd83961f9c
7
- data.tar.gz: 8b3288422002936ba26d3c3bc125935248690c869d1f687e128f1faf5d2e89ed9c2007f093193c2ec33edc143a367a20a39710b7f4207f5c054a157f175d5779
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
+ [![Build Status](https://travis-ci.org/theangryangel/logstash-output-jdbc.svg?branch=master)](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 not listed, let me know and provide a small example configuration.
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 = @pool.getConnection()
198
- statement = connection.prepareStatement(@statement[0])
197
+ connection = nil
198
+ statement = nil
199
+ begin
200
+ connection = @pool.getConnection()
201
+ statement = connection.prepareStatement(@statement[0])
199
202
 
200
- events.each do |event|
201
- next if event.cancelled?
202
- next if @statement.length < 2
203
- statement = add_statement_event_params(statement, event)
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
- statement.addBatch()
206
- end
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
- connection.close();
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 = @pool.getConnection()
223
+ connection = nil
224
+ statement = nil
225
+ begin
226
+ connection = @pool.getConnection()
225
227
 
226
- events.each do |event|
227
- next if event.cancelled?
228
-
229
- statement = connection.prepareStatement(event.sprintf(@statement[0]))
230
- statement = add_statement_event_params(statement, event) if @statement.length > 1
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
 
@@ -88,6 +88,7 @@ describe LogStash::Outputs::Jdbc do
88
88
  end
89
89
  stmt.close()
90
90
  c.close()
91
+
91
92
  expect(count).to be > 0
92
93
  end
93
94
 
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.5
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 00:00:00.000000000 Z
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: '0'
112
+ version: 1.3.1
113
113
  requirements: []
114
114
  rubyforge_project:
115
115
  rubygems_version: 2.0.14.1