Class: LogStash::Filters::JdbcStreaming

Inherits:
Base
  • Object
show all
Includes:
PluginMixins::JdbcStreaming
Defined in:
lib/logstash/filters/jdbc_streaming.rb

Defined Under Namespace

Classes: CachePayload, NoCache, RowCache

Instance Method Summary collapse

Methods included from PluginMixins::JdbcStreaming

included, #prepare_jdbc_connection, #setup_jdbc_config

Instance Method Details

#closeObject



134
135
136
137
138
# File 'lib/logstash/filters/jdbc_streaming.rb', line 134

def close
  @database.disconnect
rescue => e
  logger.warn("Exception caught when attempting to close filter.", :exception => e.message, :backtrace => e.backtrace)
end

#filter(event) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/logstash/filters/jdbc_streaming.rb', line 119

def filter(event)
  result = cache_lookup(event) # should return a JdbcCachePayload

  if result.failed?
    tag_failure(event)
  end

  if result.empty?
    tag_default(event)
    process_event(event, @default_array)
  else
    process_event(event, result.payload)
  end
end

#registerObject



114
115
116
117
# File 'lib/logstash/filters/jdbc_streaming.rb', line 114

def register
  convert_config_options
  prepare_connected_jdbc_cache
end