logstash-integration-jdbc 5.5.3 → 5.6.1

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
  SHA256:
3
- metadata.gz: a28e2a3a37342bc631ed300da7fa687e99fc879d8cc599669d64e2cfc6418177
4
- data.tar.gz: 38b675462f29af81148dbdcc58144a2e3df932b6c6a44825b580a3468ac90acb
3
+ metadata.gz: b8af04cbdc4227939fa52c842815d13ffe85864f4ae0b6e9eade6f393edce935
4
+ data.tar.gz: b699ebedee5e9f982605998031e00933a69adac1b10018077e0411bc0dcae82c
5
5
  SHA512:
6
- metadata.gz: b3af9d1d0c7ddc88b8102d7fafb96a9c379a734266698a3136e9e9522f640f64f4f019ea5820c9bc382a460df5f47f2fc62bb6cf8c3ad47ad84f5069710831cd
7
- data.tar.gz: 41a6e399b350068d1ed337c158b94f9457f0ace2f31588888db8c99b9e20a39f7fe0f06ab4e809cd01c7a635c9ede2a00629aa1ecf04b9cd86951fdda5c9a828
6
+ metadata.gz: b25765b2945b4f6ad118a995ddc2a2350bca8a5390421f0707258f0cc65929cc5f06ce2bb317665338070e88a93c2442eeaf3604ca3325dfc3c511cecc58479f
7
+ data.tar.gz: 6ece1fa9e292c209d884e307db110ac64bca886de473dff145420c2a786174f6a87c66af19a8154c893f48dcecbd142d09af2918cee913bd483baa4813e55127
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.6.1
2
+ - Fixes an issue where the `jdbc_static` filter's throughput was artificially limited to 4 concurrent queries, causing the plugin to become a bottleneck in pipelines with more than 4 workers. Each instance of the plugin is now limited to 16 concurrent queries, with increased timeouts to eliminate enrichment failures [#187](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/187)
3
+
4
+ ## 5.6.0
5
+ - Support other rufus scheduling options in JDBC Input [#183](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/183)
6
+
1
7
  ## 5.5.3
2
8
  - [DOC] Rework inline comment to a callout in preparation for upcoming MD conversion [#181](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/181)
3
9
 
@@ -41,9 +41,9 @@ options for more info.
41
41
 
42
42
  Input from this plugin can be scheduled to run periodically according to a specific
43
43
  schedule. This scheduling syntax is powered by https://github.com/jmettraux/rufus-scheduler[rufus-scheduler].
44
- The syntax is cron-like with some extensions specific to Rufus (e.g. timezone support ).
44
+ The syntax is either cron-like with some extensions specific to Rufus (e.g. timezone support ) if using the `schedule` option or periodic when using `period` or `interval` option.
45
45
 
46
- Examples:
46
+ Examples for `schedule`:
47
47
 
48
48
  |==========================================================
49
49
  | `* 5 * 1-3 *` | will execute every minute of 5am every day of January through March.
@@ -51,9 +51,21 @@ Examples:
51
51
  | `0 6 * * * America/Chicago` | will execute at 6:00am (UTC/GMT -5) every day.
52
52
  |==========================================================
53
53
 
54
+ Examples for `period` or `interval`:
55
+
56
+ |==========================================================
57
+ | `1m` | will execute every minute
58
+ | `3h10m` | will execute every three hours and 10 minutes
59
+ |==========================================================
54
60
 
55
61
  Further documentation describing this syntax can be found https://github.com/jmettraux/rufus-scheduler#parsing-cronlines-and-time-strings[here].
56
62
 
63
+ `interval` jobs trigger, execute and then trigger again after the interval elapsed.
64
+
65
+ `period` jobs try to trigger following the frequency they were scheduled with.
66
+
67
+ You can only use one of `interval`, `period` or `schedule` at the same time.
68
+
57
69
  ==== State
58
70
 
59
71
  The plugin will persist the `sql_last_value` parameter in the form of a
@@ -212,6 +224,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
212
224
  | <<plugins-{type}s-{plugin}-columns_charset>> |<<hash,hash>>|No
213
225
  | <<plugins-{type}s-{plugin}-connection_retry_attempts>> |<<number,number>>|No
214
226
  | <<plugins-{type}s-{plugin}-connection_retry_attempts_wait_time>> |<<number,number>>|No
227
+ | <<plugins-{type}s-{plugin}-interval>> |<<string,string>>|No
215
228
  | <<plugins-{type}s-{plugin}-jdbc_connection_string>> |<<string,string>>|Yes
216
229
  | <<plugins-{type}s-{plugin}-jdbc_default_timezone>> |<<string,string>>|No
217
230
  | <<plugins-{type}s-{plugin}-jdbc_driver_class>> |<<string,string>>|Yes
@@ -229,6 +242,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
229
242
  | <<plugins-{type}s-{plugin}-last_run_metadata_path>> |<<string,string>>|No
230
243
  | <<plugins-{type}s-{plugin}-lowercase_column_names>> |<<boolean,boolean>>|No
231
244
  | <<plugins-{type}s-{plugin}-parameters>> |<<hash,hash>>|No
245
+ | <<plugins-{type}s-{plugin}-period>> |<<string,string>>|No
232
246
  | <<plugins-{type}s-{plugin}-plugin_timezone>> |<<string,string>>, one of `["local", "utc"]`|No
233
247
  | <<plugins-{type}s-{plugin}-prepared_statement_bind_values>> |<<array,array>>|No
234
248
  | <<plugins-{type}s-{plugin}-prepared_statement_name>> |<<string,string>>|No
@@ -298,6 +312,16 @@ Maximum number of times to try connecting to database
298
312
 
299
313
  Number of seconds to sleep between connection attempts
300
314
 
315
+ [id="plugins-{type}s-{plugin}-interval"]
316
+ ===== `interval`
317
+
318
+ * Value type is <<string,string>>
319
+ * There is no default value for this setting.
320
+
321
+ This takes a string in the form of `1h`, `1m`, to denote a time interval. `interval` jobs trigger, execute and trigger again after the provided time interval has elapsed.
322
+
323
+ There is no schedule by default. If no scheduling statement is given, then the statement is run exactly once.
324
+
301
325
  [id="plugins-{type}s-{plugin}-jdbc_connection_string"]
302
326
  ===== `jdbc_connection_string`
303
327
 
@@ -538,6 +562,16 @@ Whether to force the lowercasing of identifier fields
538
562
 
539
563
  Hash of query parameter, for example `{ "target_id" => "321" }`
540
564
 
565
+ [id="plugins-{type}s-{plugin}-period"]
566
+ ===== `period`
567
+
568
+ * Value type is <<string,string>>
569
+ * There is no default value for this setting.
570
+
571
+ This takes a string in the form of `1h`, `1m`, to denote a time interval. `period` jobs try hard to trigger following the frequency they were scheduled with.
572
+
573
+ There is no schedule by default. If no scheduling statement is given, then the statement is run exactly once.
574
+
541
575
  [id="plugins-{type}s-{plugin}-prepared_statement_bind_values"]
542
576
  ===== `prepared_statement_bind_values`
543
577
 
@@ -568,11 +602,9 @@ Whether to save state or not in <<plugins-{type}s-{plugin}-last_run_metadata_pat
568
602
  * Value type is <<string,string>>
569
603
  * There is no default value for this setting.
570
604
 
571
- Schedule of when to periodically run statement, in Cron format
572
- for example: "* * * * *" (execute query every minute, on the minute)
605
+ Schedule of when to periodically run statement, in Cron format for example: "* * * * *" (execute query every minute, on the minute)
573
606
 
574
- There is no schedule by default. If no schedule is given, then the statement is run
575
- exactly once.
607
+ There is no schedule by default. If no scheduling statement is given, then the statement is run exactly once.
576
608
 
577
609
  [id="plugins-{type}s-{plugin}-sequel_opts"]
578
610
  ===== `sequel_opts`
@@ -103,6 +103,11 @@ module LogStash module Filters module Jdbc
103
103
  super
104
104
  # get a fair reentrant read write lock
105
105
  @rwlock = java.util.concurrent.locks.ReentrantReadWriteLock.new(true)
106
+
107
+ # configure the connection pool to reduce the chances of
108
+ # a worker thread being unable to acquire a connection.
109
+ @options_hash[:max_connections] = 16 # sequel default: 4
110
+ @options_hash[:pool_timeout] = 30 # sequel default: 5
106
111
  end
107
112
  end
108
113
  end end end
@@ -180,6 +180,20 @@ module LogStash module Inputs class Jdbc < LogStash::Inputs::Base
180
180
  # exactly once.
181
181
  config :schedule, :validate => :string
182
182
 
183
+ # Interval of how soon to run statement again after completion
184
+ # for example: "1m" (execute again 1 minute after completion)
185
+ #
186
+ # There is no interval by default. If no interval is given, then the statement is run
187
+ # exactly once.
188
+ config :interval, :validate => :string
189
+
190
+ # Start the job periodically after time elapsed
191
+ # for example: "1m" (execute query every minute)
192
+ #
193
+ # There is no period by default. If no period is given, then the statement is run
194
+ # exactly once.
195
+ config :period, :validate => :string
196
+
183
197
  # Path to file with last run time.
184
198
  # The default will write file to `<path.data>/plugins/inputs/jdbc/logstash_jdbc_last_run`
185
199
  # NOTE: it must be a file path and not a directory path
@@ -241,6 +255,11 @@ module LogStash module Inputs class Jdbc < LogStash::Inputs::Base
241
255
  def register
242
256
  @logger = self.logger
243
257
 
258
+ if [@interval, @schedule, @period].compact.size > 1
259
+ raise LogStash::ConfigurationError.new("Use only one of: interval, period, schedule.")
260
+ end
261
+
262
+
244
263
  if @record_last_run
245
264
  if @last_run_metadata_path.nil?
246
265
  logstash_data_path = LogStash::SETTINGS.get_value("path.data")
@@ -322,6 +341,12 @@ module LogStash module Inputs class Jdbc < LogStash::Inputs::Base
322
341
  # scheduler input thread name example: "[my-oracle]|input|jdbc|scheduler"
323
342
  scheduler.cron(@schedule) { execute_query(queue) }
324
343
  scheduler.join
344
+ elsif @interval
345
+ scheduler.interval(@interval) { execute_query(queue) }
346
+ scheduler.join
347
+ elsif @period
348
+ scheduler.every(@period) { execute_query(queue) }
349
+ scheduler.join
325
350
  else
326
351
  execute_query(queue)
327
352
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-jdbc'
3
- s.version = '5.5.3'
3
+ s.version = '5.6.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Integration with JDBC - input and filter plugins"
6
6
  s.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 gemname. This gem is not a stand-alone program"
@@ -19,8 +19,13 @@ module LogStash module Filters module Jdbc
19
19
  stub_driver_class = double('org.apache.derby.jdbc.EmbeddedDriver').as_null_object
20
20
  expect(::Sequel::JDBC).to receive(:load_driver).once.with("org.apache.derby.jdbc.EmbeddedDriver").and_return(stub_driver_class)
21
21
  # two calls to connect because ReadWriteDatabase does verify_connection and connect
22
- expect(::Sequel).to receive(:connect).once.with(connection_string_regex, {:driver => stub_driver_class, :test => true}).and_return(db)
23
- expect(::Sequel).to receive(:connect).once.with(connection_string_regex, {:driver => stub_driver_class}).and_return(db)
22
+ connection_options = {
23
+ driver: stub_driver_class,
24
+ max_connections: 16,
25
+ pool_timeout: 30,
26
+ }
27
+ expect(::Sequel).to receive(:connect).once.with(connection_string_regex, connection_options.merge(:test => true)).and_return(db)
28
+ expect(::Sequel).to receive(:connect).once.with(connection_string_regex, connection_options).and_return(db)
24
29
  expect(read_write_db.empty_record_set).to eq([])
25
30
  end
26
31
 
@@ -30,8 +35,17 @@ module LogStash module Filters module Jdbc
30
35
  password = Util::Password.new("secret")
31
36
  stub_driver_class = double('com.example.Driver')
32
37
  expect(::Sequel::JDBC).to receive(:load_driver).once.with("a driver class").and_return(stub_driver_class)
33
- expect(::Sequel).to receive(:connect).once.with(connection_str, {:driver => stub_driver_class, :user => user, :password => password.value, :test => true}).and_return(db)
34
- expect(::Sequel).to receive(:connect).once.with(connection_str, {:driver => stub_driver_class, :user => user, :password => password.value}).and_return(db)
38
+
39
+ connection_options = {
40
+ driver: stub_driver_class,
41
+ user: user,
42
+ password: password.value,
43
+ max_connections: 16,
44
+ pool_timeout: 30,
45
+ }
46
+
47
+ expect(::Sequel).to receive(:connect).once.with(connection_str, connection_options.merge(:test => true)).and_return(db)
48
+ expect(::Sequel).to receive(:connect).once.with(connection_str, connection_options).and_return(db)
35
49
  described_class.create(connection_str, "a driver class", nil, user, password)
36
50
  end
37
51
  end
@@ -228,6 +228,33 @@ describe LogStash::Inputs::Jdbc do
228
228
  end
229
229
  end
230
230
 
231
+ describe "scheduling options" do
232
+ let(:settings) { super().merge("statement" => "SELECT :num_param as num_param FROM SYSIBM.SYSDUMMY1") }
233
+ scheduling_options = ["interval", "schedule", "period"]
234
+ scheduling_options.combination(2).each do |option1, option2|
235
+ context "when using '#{option1}' and '#{option2}' at the same time" do
236
+ let(:settings) { super().merge(option1 => 'a', option2 => 'b') }
237
+ it "raises a configuration error" do
238
+ expect { plugin.register }.to raise_error(LogStash::ConfigurationError, /Use only one/)
239
+ end
240
+ end
241
+ end
242
+ context "when using 'schedule', 'period' and 'interval' at the same time" do
243
+ let(:settings) { super().merge("interval" => "a", "period" => "b", "schedule" => "c") }
244
+ it "raises a configuration error" do
245
+ expect { plugin.register }.to raise_error(LogStash::ConfigurationError, /Use only one/)
246
+ end
247
+ end
248
+ scheduling_options.each do |option|
249
+ context "when using only '#{option}'" do
250
+ let(:settings) { super().merge(option => "a") }
251
+ it "does not raise a configuration error" do
252
+ expect { plugin.register }.to_not raise_error
253
+ end
254
+ end
255
+ end
256
+ end
257
+
231
258
  context "when scheduling" do
232
259
  let(:settings) { {"statement" => "SELECT 1 as num_param FROM SYSIBM.SYSDUMMY1", "schedule" => "* * * * * UTC"} }
233
260
 
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.3
4
+ version: 5.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-03-07 00:00:00.000000000 Z
10
+ date: 2025-09-30 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
13
+ name: logstash-core-plugin-api
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
@@ -19,7 +19,6 @@ dependencies:
19
19
  - - "<="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.99'
22
- name: logstash-core-plugin-api
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,12 +30,12 @@ dependencies:
31
30
  - !ruby/object:Gem::Version
32
31
  version: '2.99'
33
32
  - !ruby/object:Gem::Dependency
33
+ name: logstash-core
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
36
  - - ">="
37
37
  - !ruby/object:Gem::Version
38
38
  version: 6.5.0
39
- name: logstash-core
40
39
  type: :runtime
41
40
  prerelease: false
42
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -45,12 +44,12 @@ dependencies:
45
44
  - !ruby/object:Gem::Version
46
45
  version: 6.5.0
47
46
  - !ruby/object:Gem::Dependency
47
+ name: logstash-codec-plain
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
- name: logstash-codec-plain
54
53
  type: :runtime
55
54
  prerelease: false
56
55
  version_requirements: !ruby/object:Gem::Requirement
@@ -59,12 +58,12 @@ dependencies:
59
58
  - !ruby/object:Gem::Version
60
59
  version: '0'
61
60
  - !ruby/object:Gem::Dependency
61
+ name: sequel
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 5.74.0
67
- name: sequel
68
67
  type: :runtime
69
68
  prerelease: false
70
69
  version_requirements: !ruby/object:Gem::Requirement
@@ -73,12 +72,12 @@ dependencies:
73
72
  - !ruby/object:Gem::Version
74
73
  version: 5.74.0
75
74
  - !ruby/object:Gem::Dependency
75
+ name: lru_redux
76
76
  requirement: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
- name: lru_redux
82
81
  type: :runtime
83
82
  prerelease: false
84
83
  version_requirements: !ruby/object:Gem::Requirement
@@ -87,12 +86,12 @@ dependencies:
87
86
  - !ruby/object:Gem::Version
88
87
  version: '0'
89
88
  - !ruby/object:Gem::Dependency
89
+ name: tzinfo
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
- name: tzinfo
96
95
  type: :runtime
97
96
  prerelease: false
98
97
  version_requirements: !ruby/object:Gem::Requirement
@@ -101,12 +100,12 @@ dependencies:
101
100
  - !ruby/object:Gem::Version
102
101
  version: '0'
103
102
  - !ruby/object:Gem::Dependency
103
+ name: tzinfo-data
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
- name: tzinfo-data
110
109
  type: :runtime
111
110
  prerelease: false
112
111
  version_requirements: !ruby/object:Gem::Requirement
@@ -115,12 +114,12 @@ dependencies:
115
114
  - !ruby/object:Gem::Version
116
115
  version: '0'
117
116
  - !ruby/object:Gem::Dependency
117
+ name: logstash-mixin-ecs_compatibility_support
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
122
  version: '1.3'
123
- name: logstash-mixin-ecs_compatibility_support
124
123
  type: :runtime
125
124
  prerelease: false
126
125
  version_requirements: !ruby/object:Gem::Requirement
@@ -129,12 +128,12 @@ dependencies:
129
128
  - !ruby/object:Gem::Version
130
129
  version: '1.3'
131
130
  - !ruby/object:Gem::Dependency
131
+ name: logstash-mixin-validator_support
132
132
  requirement: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '1.0'
137
- name: logstash-mixin-validator_support
138
137
  type: :runtime
139
138
  prerelease: false
140
139
  version_requirements: !ruby/object:Gem::Requirement
@@ -143,12 +142,12 @@ dependencies:
143
142
  - !ruby/object:Gem::Version
144
143
  version: '1.0'
145
144
  - !ruby/object:Gem::Dependency
145
+ name: logstash-mixin-event_support
146
146
  requirement: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
150
  version: '1.0'
151
- name: logstash-mixin-event_support
152
151
  type: :runtime
153
152
  prerelease: false
154
153
  version_requirements: !ruby/object:Gem::Requirement
@@ -157,12 +156,12 @@ dependencies:
157
156
  - !ruby/object:Gem::Version
158
157
  version: '1.0'
159
158
  - !ruby/object:Gem::Dependency
159
+ name: logstash-mixin-scheduler
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
164
  version: '1.0'
165
- name: logstash-mixin-scheduler
166
165
  type: :runtime
167
166
  prerelease: false
168
167
  version_requirements: !ruby/object:Gem::Requirement
@@ -171,12 +170,12 @@ dependencies:
171
170
  - !ruby/object:Gem::Version
172
171
  version: '1.0'
173
172
  - !ruby/object:Gem::Dependency
173
+ name: childprocess
174
174
  requirement: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - ">="
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
- name: childprocess
180
179
  type: :development
181
180
  prerelease: false
182
181
  version_requirements: !ruby/object:Gem::Requirement
@@ -185,12 +184,12 @@ dependencies:
185
184
  - !ruby/object:Gem::Version
186
185
  version: '0'
187
186
  - !ruby/object:Gem::Dependency
187
+ name: logstash-devutils
188
188
  requirement: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - ">="
191
191
  - !ruby/object:Gem::Version
192
192
  version: '2.3'
193
- name: logstash-devutils
194
193
  type: :development
195
194
  prerelease: false
196
195
  version_requirements: !ruby/object:Gem::Requirement
@@ -199,12 +198,12 @@ dependencies:
199
198
  - !ruby/object:Gem::Version
200
199
  version: '2.3'
201
200
  - !ruby/object:Gem::Dependency
201
+ name: timecop
202
202
  requirement: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - ">="
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
- name: timecop
208
207
  type: :development
209
208
  prerelease: false
210
209
  version_requirements: !ruby/object:Gem::Requirement
@@ -294,7 +293,6 @@ metadata:
294
293
  logstash_plugin: 'true'
295
294
  logstash_group: integration
296
295
  integration_plugins: logstash-input-jdbc,logstash-filter-jdbc_streaming,logstash-filter-jdbc_static
297
- post_install_message:
298
296
  rdoc_options: []
299
297
  require_paths:
300
298
  - lib
@@ -310,8 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
308
  - !ruby/object:Gem::Version
311
309
  version: '0'
312
310
  requirements: []
313
- rubygems_version: 3.3.26
314
- signing_key:
311
+ rubygems_version: 3.6.3
315
312
  specification_version: 4
316
313
  summary: Integration with JDBC - input and filter plugins
317
314
  test_files: