Addresses 22 not giving warning about incorrectly configured statements

This commit is contained in:
Karl Southern 2015-12-23 10:06:50 +00:00
parent bfcd9bf69a
commit 529c98aadb
2 changed files with 12 additions and 1 deletions

View File

@ -17,6 +17,9 @@ particular location. Please ensure you read the 4 installation lines below.
- Altered exception handling to now count sequential flushes with exceptions thrown in 0.2.0 - Altered exception handling to now count sequential flushes with exceptions thrown in 0.2.0
## Versions ## Versions
Released versions are are tagged as of v0.2.1, and available via rubygems.
For development:
- See master branch for logstash v2+ - See master branch for logstash v2+
- See v1.5 branch for logstash v1.5 - See v1.5 branch for logstash v1.5
- See v1.4 branch for logstash 1.4 - See v1.4 branch for logstash 1.4
@ -24,7 +27,7 @@ particular location. Please ensure you read the 4 installation lines below.
## Installation ## Installation
- Run `bin/plugin install logstash-output-jdbc` in your logstash installation directory - Run `bin/plugin install logstash-output-jdbc` in your logstash installation directory
- Now either: - Now either:
- Use driver_class in your configuraton to specify a path to your jar file - Use driver_path in your configuraton to specify a path to your jar file
- Or: - Or:
- Create the directory vendor/jar/jdbc in your logstash installation (`mkdir -p vendor/jar/jdbc/`) - Create the directory vendor/jar/jdbc in your logstash installation (`mkdir -p vendor/jar/jdbc/`)
- Add JDBC jar files to vendor/jar/jdbc in your logstash installation - Add JDBC jar files to vendor/jar/jdbc in your logstash installation

View File

@ -102,6 +102,14 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
@logger.warn("JDBC - Flush size is set to > 1000") @logger.warn("JDBC - Flush size is set to > 1000")
end end
if @statement.length < 1
@logger.error("JDBC - No statement provided. Configuration error.")
end
if (!@unsafe_statement and @statement.length < 2)
@logger.error("JDBC - Statement has no parameters. No events will be inserted into SQL as you're not passing any event data. Likely configuration error.")
end
buffer_initialize( buffer_initialize(
:max_items => @flush_size, :max_items => @flush_size,
:max_interval => @idle_flush_time, :max_interval => @idle_flush_time,