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



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

alias_method :old_validate_value, :validate_value

.validate_value(value, validator) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/logstash/filters/jdbc_static.rb', line 133

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



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

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

#filter(event) ⇒ Object



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

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

#loader_runnerObject



169
170
171
172
# File 'lib/logstash/filters/jdbc_static.rb', line 169

def loader_runner
  # use for test verification
  @loader_runner
end

#registerObject



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

def register
  prepare_data_dir
  prepare_runner
end