Class: LogStash::Filters::JdbcStatic

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.old_validate_valueObject



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

alias_method :old_validate_value, :validate_value

.validate_value(value, validator) ⇒ Object



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

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



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

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

#filter(event) ⇒ Object



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

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

#loader_runnerObject



171
172
173
174
# File 'lib/logstash/filters/jdbc_static.rb', line 171

def loader_runner
  # use for test verification
  @loader_runner
end

#registerObject



156
157
158
159
# File 'lib/logstash/filters/jdbc_static.rb', line 156

def register
  prepare_data_dir
  prepare_runner
end