Class: LogStash::Outputs::Jdbc
- Inherits:
-
Base
- Object
- Base
- LogStash::Outputs::Jdbc
- Defined in:
- lib/logstash/outputs/jdbc.rb
Overview
Write events to a SQL engine, using JDBC.
It is upto the user of the plugin to correctly configure the plugin. This includes correctly crafting the SQL statement, and matching the number of parameters correctly.
Constant Summary collapse
- STRFTIME_FMT =
'%Y-%m-%d %T.%L'.freeze
- RETRYABLE_SQLSTATE_CLASSES =
[ # Classes of retryable SQLSTATE codes # Not all in the class will be retryable. However, this is the best that # we've got right now. # If a custom state code is required, set it in retry_sql_states. '08', # Connection Exception '24', # Invalid Cursor State (Maybe retry-able in some circumstances) '25', # Invalid Transaction State '40', # Transaction Rollback '53', # Insufficient Resources '54', # Program Limit Exceeded (MAYBE) '55', # Object Not In Prerequisite State '57', # Operator Intervention '58', # System Error ].freeze
Instance Method Summary collapse
Instance Method Details
#close ⇒ Object
136 137 138 139 140 |
# File 'lib/logstash/outputs/jdbc.rb', line 136 def close @stopping.make_true @pool.close super end |
#multi_receive(events) ⇒ Object
130 131 132 133 134 |
# File 'lib/logstash/outputs/jdbc.rb', line 130 def multi_receive(events) events.each_slice(@flush_size) do |slice| (slice) end end |
#register ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/logstash/outputs/jdbc.rb', line 110 def register @logger.info('JDBC - Starting up') load_jar_files! @stopping = Concurrent::AtomicBoolean.new(false) @logger.warn('JDBC - Flush size is set to > 1000') if @flush_size > 1000 if @statement.empty? @logger.error('JDBC - No statement provided. Configuration error.') end if !@unsafe_statement && @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 setup_and_test_pool! end |