logstash-filter-jdbc_static 1.0.2 → 1.0.3

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: 14fbe648ee79593894c1735cc82823cc34dc423db0eb36e7d8f400e00290fbed
4
- data.tar.gz: e8d9c13670e105dea7c59544d92e8eed15fb7bdcb7a0d2fc8e4069c4b139e20d
3
+ metadata.gz: cb24eb800c3a6892758e80502333948872a5a2c95ee3c0e0999c17477391449b
4
+ data.tar.gz: f114952a1f694bc161d2715efa6f20002c1f3d4ed8751cf4b476bed994b60718
5
5
  SHA512:
6
- metadata.gz: 89fbedbb6c4258964e1a947830b95e3551118e04262637a5807d16b1dc8063517351d84ffc7ce31d72ed4eb16f352d20496f9f009bd570c70024d51827b84740
7
- data.tar.gz: a132cdb916d82f0ea1eed798363bf50c092b1713a68df623ded472538e2bc5310c3b07a6de89c71223e20eeae99add66a6b413fecfa53518614dc0aa54bcdc64
6
+ metadata.gz: ab35006f966c8b29f1c6389821ada1c2817883159710bb63cb106c4710445cc2af175835986cb9f5e5e76c686774c200f4d6b054f4f3cff85565a3b379635190
7
+ data.tar.gz: bf40037a0d5c43c87808fbbb6ec2468a36c87b2ff1b1753150e6bc1952c468b92ba043fcd4c1e06f1d13b2c53f14ec3294144beb27b7eb2cb5e643e20d1aaf9a
@@ -1,5 +1,8 @@
1
+ ## 1.0.3
2
+ - Fix [jdbc_static filter - #25](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/25) When index_columns is not specified, the create table statement has a syntax error.
3
+
1
4
  ## 1.0.2
2
- - Fix Fix [jdbc_static filter - #22](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/22) Support multiple driver libraries.
5
+ - Fix [jdbc_static filter - #22](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/22) Support multiple driver libraries.
3
6
  - Fixes for [jdbc_static filter - #18](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/18), [jdbc_static filter - #17](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/17), [jdbc_static filter - #12](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/12) Use Java classloader to load driver jar. Use system import from file to loader local database. Prevent locking errors when no records returned.
4
7
  - Fix [jdbc_static filter - #8](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/8) loader_schedule now works as designed.
5
8
 
@@ -16,7 +16,7 @@ module LogStash module Filters module Jdbc
16
16
  end
17
17
  schema_gen = db.create_table_generator()
18
18
  @columns.each {|col| schema_gen.column(col.name, col.datatype)}
19
- schema_gen.index(@index_columns)
19
+ schema_gen.index(@index_columns) unless @index_columns.empty?
20
20
  options = {:generator => schema_gen}
21
21
  if @preserve_existing
22
22
  db.create_table?(@name, options)
@@ -31,6 +31,9 @@ module LogStash module Filters module Jdbc
31
31
  begin
32
32
  @rwlock.writeLock().lock()
33
33
  db_object.build(@db)
34
+ if db_object.index_columns.empty?
35
+ logger.warn("local_db_object '#{db_object.name}': `index_columns` is optional but on larger datasets consider adding an index on the lookup column, it will improve performance")
36
+ end
34
37
  rescue *CONNECTION_ERRORS => err
35
38
  # we do not raise an error when there is a connection error, we hope that the connection works next time
36
39
  logger.error("Connection error when initialising lookup db", :db_object => db_object.inspect, :exception => err.message, :backtrace => err.backtrace.take(8))
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-jdbc_static'
3
- s.version = '1.0.2'
3
+ s.version = '1.0.3'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "This filter executes a SQL query to fetch a SQL query result, store it locally then use a second SQL query to update an event."
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"
@@ -6,7 +6,7 @@ require "sequel/adapters/jdbc"
6
6
  require "stud/temporary"
7
7
  require "timecop"
8
8
 
9
- LogStash::Logging::Logger::configure_logging("ERROR")
9
+ # LogStash::Logging::Logger::configure_logging("WARN")
10
10
 
11
11
  module LogStash module Filters
12
12
  describe JdbcStatic do
@@ -123,6 +123,19 @@ module LogStash module Filters
123
123
  expect(event.get("server")).to eq([{"ip"=>ipaddr, "name"=>"server-254-255", "location"=>"MV-10-254-255"}])
124
124
  end
125
125
  end
126
+
127
+ context "under normal conditions when index_columns is not specified" do
128
+ let(:local_db_objects) do
129
+ [
130
+ {"name" => "servers", "columns" => [["ip", "varchar(64)"], ["name", "varchar(64)"], ["location", "varchar(64)"]]},
131
+ ]
132
+ end
133
+ it "enhances an event" do
134
+ plugin.register
135
+ plugin.filter(event)
136
+ expect(event.get("server")).to eq([{"ip"=>"10.3.1.1", "name"=>"mv-serv'r-1", "location"=>"MV-9-6-4"}])
137
+ end
138
+ end
126
139
  end
127
140
 
128
141
  describe "scheduled operation" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-jdbc_static
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-20 00:00:00.000000000 Z
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement