logstash-filter-jdbc_streaming 1.0.9 → 1.0.10
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/lib/logstash/plugin_mixins/jdbc_streaming.rb +13 -22
- data/logstash-filter-jdbc_streaming.gemspec +1 -2
- data/spec/integration/jdbcstreaming_spec.rb +2 -15
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68322804fb8d02a7f7831e6ea4eb3c47514e02033ae3ffa8d7f562a9a9ac25fe
|
4
|
+
data.tar.gz: 1fbbb4043350281a2660c6b7108ad1d2cff58ac98ef35ae695a8028c253f7d21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74996330617c8b291b4f09ebe001c91d76ed6e07de666b40f6260e2fb0a63b4c6140519ba3f5199db7953f2511d70333d21d7bc20dc3a5fdbfa05271cba1b423
|
7
|
+
data.tar.gz: eb7a1d7750383f2678b319933a645a529f582165c32bdb2689a939b10628024bf169b06972aeabca9ba6b4f34bcbd5abe07d81991d2bf5ef348e4464d95ed31a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 1.0.10
|
2
|
+
- Fixed driver loading [#35](https://github.com/logstash-plugins/logstash-filter-jdbc_streaming/pull/35)
|
3
|
+
|
1
4
|
## 1.0.9
|
2
5
|
- Added support for prepared statements [PR 32](https://github.com/logstash-plugins/logstash-filter-jdbc_streaming/pull/32)
|
3
6
|
- Added support for `sequel_opts` to pass options to the 3rd party Sequel library.
|
@@ -58,28 +58,19 @@ module LogStash module PluginMixins module JdbcStreaming
|
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
def load_driver_jars
|
62
|
+
unless @jdbc_driver_library.nil? || @jdbc_driver_library.empty?
|
63
|
+
@jdbc_driver_library.split(",").each do |driver_jar|
|
64
|
+
begin
|
65
|
+
@logger.debug("loading #{driver_jar}")
|
66
|
+
# Use https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby#from-jar-files to make classes from jar
|
67
|
+
# available
|
68
|
+
require driver_jar
|
69
|
+
rescue LoadError => e
|
70
|
+
raise LogStash::PluginLoadingError, "unable to load #{driver_jar} from :jdbc_driver_library, #{e.message}"
|
71
|
+
end
|
69
72
|
end
|
70
|
-
|
71
|
-
begin
|
72
|
-
klass = java.lang.Class.forName(@jdbc_driver_class.to_java(:string), true, ucl);
|
73
|
-
rescue Java::JavaLang::ClassNotFoundException => e
|
74
|
-
raise LogStash::Error, "Unable to find driver class via URLClassLoader in given driver jars: #{@jdbc_driver_class}"
|
75
|
-
end
|
76
|
-
begin
|
77
|
-
driver = klass.getConstructor().newInstance();
|
78
|
-
java.sql.DriverManager.register_driver(WrappedDriver.new(driver.to_java(java.sql.Driver)).to_java(java.sql.Driver))
|
79
|
-
rescue Java::JavaSql::SQLException => e
|
80
|
-
raise LogStash::Error, "Unable to register driver with java.sql.DriverManager using WrappedDriver: #{@jdbc_driver_class}"
|
81
|
-
end
|
82
|
-
|
73
|
+
end
|
83
74
|
end
|
84
75
|
|
85
76
|
public
|
@@ -88,7 +79,7 @@ module LogStash module PluginMixins module JdbcStreaming
|
|
88
79
|
require "sequel/adapters/jdbc"
|
89
80
|
require "java"
|
90
81
|
|
91
|
-
|
82
|
+
load_driver_jars
|
92
83
|
|
93
84
|
@sequel_opts_symbols = @sequel_opts.inject({}) {|hash, (k,v)| hash[k.to_sym] = v; hash}
|
94
85
|
@sequel_opts_symbols[:user] = @jdbc_user unless @jdbc_user.nil? || @jdbc_user.empty?
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-jdbc_streaming'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.10'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Enrich events with your database data"
|
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/plugin install gemname. This gem is not a stand-alone program"
|
@@ -25,5 +25,4 @@ Gem::Specification.new do |s|
|
|
25
25
|
|
26
26
|
s.add_development_dependency 'logstash-devutils'
|
27
27
|
s.add_development_dependency 'jdbc-derby'
|
28
|
-
s.add_development_dependency 'jdbc-postgres'
|
29
28
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require "logstash/devutils/rspec/spec_helper"
|
2
2
|
require "logstash/filters/jdbc_streaming"
|
3
|
-
require 'jdbc/postgres'
|
4
3
|
require "sequel"
|
5
4
|
require "sequel/adapters/jdbc"
|
6
5
|
|
@@ -10,17 +9,15 @@ module LogStash module Filters
|
|
10
9
|
end
|
11
10
|
|
12
11
|
describe JdbcStreaming, :integration => true do
|
13
|
-
# Use Postgres for integration tests
|
14
|
-
::Jdbc::Postgres.load_driver
|
15
|
-
|
16
12
|
ENV["TZ"] = "Etc/UTC"
|
17
13
|
|
18
14
|
# For Travis and CI based on docker, we source from ENV
|
19
15
|
jdbc_connection_string = ENV.fetch("PG_CONNECTION_STRING",
|
20
|
-
"jdbc:postgresql://
|
16
|
+
"jdbc:postgresql://postgresql:5432") + "/jdbc_streaming_db?user=postgres"
|
21
17
|
|
22
18
|
let(:mixin_settings) do
|
23
19
|
{ "jdbc_driver_class" => "org.postgresql.Driver",
|
20
|
+
"jdbc_driver_library" => "/usr/share/logstash/postgresql.jar",
|
24
21
|
"jdbc_connection_string" => jdbc_connection_string
|
25
22
|
}
|
26
23
|
end
|
@@ -50,19 +47,9 @@ module LogStash module Filters
|
|
50
47
|
let(:ipaddr) { "10.#{idx}.1.1" }
|
51
48
|
|
52
49
|
before :each do
|
53
|
-
db.create_table :reference_table do
|
54
|
-
String :ip
|
55
|
-
String :name
|
56
|
-
String :location
|
57
|
-
end
|
58
|
-
1.upto(250) do |i|
|
59
|
-
db[:reference_table].insert(:ip => "10.#{i}.1.1", :name => "ldn-server-#{i}", :location => "LDN-#{i}-2-3")
|
60
|
-
end
|
61
50
|
plugin.register
|
62
51
|
end
|
63
52
|
|
64
|
-
after(:each) { db.drop_table(:reference_table) }
|
65
|
-
|
66
53
|
describe "found record - uses row" do
|
67
54
|
let(:idx) { 200 }
|
68
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-jdbc_streaming
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,20 +86,6 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
requirement: !ruby/object:Gem::Requirement
|
91
|
-
requirements:
|
92
|
-
- - ">="
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '0'
|
95
|
-
name: jdbc-postgres
|
96
|
-
prerelease: false
|
97
|
-
type: :development
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
89
|
description: This gem is a logstash plugin required to be installed on top of the
|
104
90
|
Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not
|
105
91
|
a stand-alone program
|