Addresses issue 26

This commit is contained in:
Karl Southern 2015-12-23 09:42:53 +00:00
parent af55fde54a
commit bfcd9bf69a
3 changed files with 12 additions and 3 deletions

View File

@ -41,6 +41,8 @@ Tests are not yet 100% complete.
| Option | Type | Description | Required? | Default | | Option | Type | Description | Required? | Default |
| ------ | ---- | ----------- | --------- | ------- | | ------ | ---- | ----------- | --------- | ------- |
| driver_class | String | Specify a driver class if autoloading fails | No | |
| driver_auto_commit | Boolean | If the driver does not support auto commit, you should set this to false | No | True |
| driver_path | String | File path to jar file containing your JDBC driver. This is optional, and all JDBC jars may be placed in $LOGSTASH_HOME/vendor/jar/jdbc instead. | No | | | driver_path | String | File path to jar file containing your JDBC driver. This is optional, and all JDBC jars may be placed in $LOGSTASH_HOME/vendor/jar/jdbc instead. | No | |
| connection_string | String | JDBC connection URL | Yes | | | connection_string | String | JDBC connection URL | Yes | |
| username | String | JDBC username - this is optional as it may be included in the connection string, for many drivers | No | | | username | String | JDBC username - this is optional as it may be included in the connection string, for many drivers | No | |

View File

@ -12,8 +12,11 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
config_name "jdbc" config_name "jdbc"
# Driver class - No longer required # Driver class - Reintroduced for https://github.com/theangryangel/logstash-output-jdbc/issues/26
config :driver_class, :obsolete => "driver_class is no longer required and can be removed from your configuration" config :driver_class, :validate => :string
# Does the JDBC driver support autocommit?
config :driver_auto_commit, :validate => :boolean, :default => true, :required => true
# Where to find the jar # Where to find the jar
# Defaults to not required, and to the original behaviour # Defaults to not required, and to the original behaviour
@ -81,6 +84,10 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
load_jar_files! load_jar_files!
@pool = Java::ComZaxxerHikari::HikariDataSource.new @pool = Java::ComZaxxerHikari::HikariDataSource.new
@pool.setAutoCommit(@driver_auto_commit)
@pool.setDriverClassName(@driver_class) if @driver_class
@pool.setJdbcUrl(@connection_string) @pool.setJdbcUrl(@connection_string)
@pool.setUsername(@username) if @username @pool.setUsername(@username) if @username

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = 'logstash-output-jdbc' s.name = 'logstash-output-jdbc'
s.version = "0.2.1" s.version = "0.2.2.rc1"
s.licenses = [ "Apache License (2.0)" ] s.licenses = [ "Apache License (2.0)" ]
s.summary = "This plugin allows you to output to SQL, via JDBC" s.summary = "This plugin allows you to output to SQL, via JDBC"
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" 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"