Skip to content

Commit

Permalink
Addresses 22 not giving warning about incorrectly configured statements
Browse files Browse the repository at this point in the history
  • Loading branch information
theangryangel committed Dec 23, 2015
1 parent bfcd9bf commit 529c98a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ 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

## Versions
Released versions are are tagged as of v0.2.1, and available via rubygems.

For development:
- See master branch for logstash v2+
- See v1.5 branch for logstash v1.5
- See v1.4 branch for logstash 1.4

## Installation
- Run `bin/plugin install logstash-output-jdbc` in your logstash installation directory
- 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:
- 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
Expand Down
8 changes: 8 additions & 0 deletions lib/logstash/outputs/jdbc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ def register
@logger.warn("JDBC - Flush size is set to > 1000")
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(
:max_items => @flush_size,
:max_interval => @idle_flush_time,
Expand Down

0 comments on commit 529c98a

Please sign in to comment.