Class: LogStash::Filters::JdbcStatic

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/filters/jdbc_static.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.old_validate_valueObject



127
# File 'lib/logstash/filters/jdbc_static.rb', line 127

alias_method :old_validate_value, :validate_value

.validate_value(value, validator) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/logstash/filters/jdbc_static.rb', line 129

def validate_value(value, validator)
  if validator.is_a?(Array) && validator.first.respond_to?(:find_validation_errors)
    validation_errors = validator.first.find_validation_errors(value)
    unless validation_errors.nil?
      return false, validation_errors
    end
  elsif validator.respond_to?(:find_validation_errors)
    validation_errors = validator.find_validation_errors(value)
    unless validation_errors.nil?
      return false, validation_errors
    end
  else
    return old_validate_value(value, validator)
  end
  [true, value]
end

Instance Method Details

#closeObject



159
160
161
162
163
# File 'lib/logstash/filters/jdbc_static.rb', line 159

def close
  @scheduler.stop if @scheduler
  @parsed_loaders.each(&:close)
  @processor.close
end

#filter(event) ⇒ Object



154
155
156
157
# File 'lib/logstash/filters/jdbc_static.rb', line 154

def filter(event)
  enhancement_states = @processor.enhance(event)
  filter_matched(event) if enhancement_states.all?
end

#loader_runnerObject



165
166
167
168
# File 'lib/logstash/filters/jdbc_static.rb', line 165

def loader_runner
  # use for test verification
  @loader_runner
end

#registerObject



149
150
151
152
# File 'lib/logstash/filters/jdbc_static.rb', line 149

def register
  prepare_data_dir
  prepare_runner
end