logstash-input-jdbc 4.2.1 → 4.2.2
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/CHANGELOG.md +3 -0
- data/docs/index.asciidoc +1 -1
- data/lib/logstash/inputs/jdbc.rb +1 -1
- data/lib/logstash/plugin_mixins/jdbc.rb +1 -1
- data/logstash-input-jdbc.gemspec +2 -1
- data/spec/inputs/jdbc_spec.rb +36 -11
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06c6146d1a00d00d4bf3dec3d65795cfd1e5dc94
|
4
|
+
data.tar.gz: dd47271869a2a33e4bea9c92681a520c6b1cfce1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbfbeb43d4a972d212d689a2bfb6d546fad9c672a9653c56546c559eacee386cc3d67e7b75bc769efc622f327dc1ed10b471a41ce6755cb722d2e60b3753b379
|
7
|
+
data.tar.gz: ae2c5aa96ccc1acc9d459a9e47014f3115a1cc1d49b835d97eb40a6a65605b5e6d9654d7b906d52abe88485104b41135af1762a8803531fecf9554e416dbe8c2
|
data/CHANGELOG.md
CHANGED
data/docs/index.asciidoc
CHANGED
data/lib/logstash/inputs/jdbc.rb
CHANGED
@@ -232,7 +232,7 @@ class LogStash::Inputs::Jdbc < LogStash::Inputs::Base
|
|
232
232
|
raise(LogStash::ConfigurationError, "Only one of :jdbc_password, :jdbc_password_filepath may be set at a time.")
|
233
233
|
end
|
234
234
|
|
235
|
-
@jdbc_password = File.read(@jdbc_password_filepath).strip if @jdbc_password_filepath
|
235
|
+
@jdbc_password = LogStash::Util::Password.new(File.read(@jdbc_password_filepath).strip) if @jdbc_password_filepath
|
236
236
|
|
237
237
|
if enable_encoding?
|
238
238
|
@converters = {}
|
@@ -171,7 +171,7 @@ module LogStash::PluginMixins::Jdbc
|
|
171
171
|
@database.test_connection
|
172
172
|
rescue Sequel::DatabaseConnectionError => e
|
173
173
|
@logger.warn("Failed test_connection.")
|
174
|
-
|
174
|
+
close_jdbc_connection
|
175
175
|
|
176
176
|
#TODO return false and let the plugin raise a LogStash::ConfigurationError
|
177
177
|
raise e
|
data/logstash-input-jdbc.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-jdbc'
|
3
|
-
s.version = '4.2.
|
3
|
+
s.version = '4.2.2'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "This example input streams a string at a definable interval."
|
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"
|
@@ -28,4 +28,5 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency 'logstash-devutils'
|
29
29
|
s.add_development_dependency 'timecop'
|
30
30
|
s.add_development_dependency 'jdbc-derby'
|
31
|
+
s.add_development_dependency 'jdbc-mysql'
|
31
32
|
end
|
data/spec/inputs/jdbc_spec.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require "logstash/devutils/rspec/spec_helper"
|
3
3
|
require "logstash/inputs/jdbc"
|
4
4
|
require "jdbc/derby"
|
5
|
+
require "jdbc/mysql"
|
6
|
+
Jdbc::MySQL.load_driver
|
5
7
|
require "sequel"
|
6
8
|
require "sequel/adapters/jdbc"
|
7
9
|
require "timecop"
|
@@ -26,19 +28,24 @@ describe LogStash::Inputs::Jdbc do
|
|
26
28
|
end
|
27
29
|
|
28
30
|
before :each do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
if !RSpec.current_example.metadata[:no_connection]
|
32
|
+
# before body
|
33
|
+
Jdbc::Derby.load_driver
|
34
|
+
db.create_table :test_table do
|
35
|
+
DateTime :created_at
|
36
|
+
Integer :num
|
37
|
+
String :string
|
38
|
+
DateTime :custom_time
|
39
|
+
end
|
40
|
+
db << "CREATE TABLE types_table (num INTEGER, string VARCHAR(255), started_at DATE, custom_time TIMESTAMP, ranking DECIMAL(16,6))"
|
41
|
+
end
|
37
42
|
end
|
38
43
|
|
39
44
|
after :each do
|
40
|
-
|
41
|
-
|
45
|
+
if !RSpec.current_example.metadata[:no_connection]
|
46
|
+
db.drop_table(:test_table)
|
47
|
+
db.drop_table(:types_table)
|
48
|
+
end
|
42
49
|
end
|
43
50
|
|
44
51
|
context "when registering and tearing down" do
|
@@ -87,6 +94,24 @@ describe LogStash::Inputs::Jdbc do
|
|
87
94
|
end
|
88
95
|
end
|
89
96
|
|
97
|
+
context "when connecting to a non-existent server", :no_connection => true do
|
98
|
+
let(:mixin_settings) do
|
99
|
+
super.merge(
|
100
|
+
"jdbc_driver_class" => "com.mysql.jdbc.Driver",
|
101
|
+
"jdbc_connection_string" => "jdbc:mysql://localhost:99999/somedb"
|
102
|
+
)
|
103
|
+
end
|
104
|
+
let(:settings) { super.merge("statement" => "SELECT 1 as col1 FROM test_table", "jdbc_user" => "foo", "jdbc_password" => "bar") }
|
105
|
+
|
106
|
+
it "should not register correctly" do
|
107
|
+
plugin.register
|
108
|
+
q = Queue.new
|
109
|
+
expect do
|
110
|
+
plugin.run(q)
|
111
|
+
end.to raise_error(::Sequel::DatabaseConnectionError)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
90
115
|
context "when both jdbc_password and jdbc_password_filepath arguments are passed" do
|
91
116
|
let(:statement) { "SELECT * from test_table" }
|
92
117
|
let(:jdbc_password) { "secret" }
|
@@ -117,7 +142,7 @@ describe LogStash::Inputs::Jdbc do
|
|
117
142
|
end
|
118
143
|
|
119
144
|
it "should read in jdbc_password from file" do
|
120
|
-
expect(plugin.jdbc_password).to eq(jdbc_password)
|
145
|
+
expect(plugin.jdbc_password.value).to eq(jdbc_password)
|
121
146
|
end
|
122
147
|
end
|
123
148
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-jdbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,20 @@ dependencies:
|
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
name: jdbc-mysql
|
152
|
+
prerelease: false
|
153
|
+
type: :development
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
145
159
|
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
|
146
160
|
email: info@elastic.co
|
147
161
|
executables: []
|