Class: LogStash::Filters::Base
Constant Summary
Config::Mixin::ENV_PLACEHOLDER_REGEX, Config::Mixin::PLUGIN_VERSION_0_9_0, Config::Mixin::PLUGIN_VERSION_1_0_0
Constants inherited
from Plugin
Plugin::NL
Instance Attribute Summary
#config, #original_params
Attributes inherited from Plugin
#params
Class Method Summary
collapse
Instance Method Summary
collapse
#config_init, included, #replace_env_placeholders
included, #logger, #slow_logger
Methods inherited from Plugin
#config_name, #debug_info, #do_close, #eql?, #hash, #id, #inspect, lookup, #metric, #metric=, #reloadable?, reloadable?, #to_s
Constructor Details
#initialize(params) ⇒ Base
Returns a new instance of Base.
126
127
128
129
130
|
# File 'lib/logstash/filters/base.rb', line 126
def initialize(params)
super
config_init(@params)
@threadsafe = true
end
|
Class Method Details
.plugin_type ⇒ Object
121
122
123
|
# File 'lib/logstash/filters/base.rb', line 121
def self.plugin_type
"filter"
end
|
Instance Method Details
#close ⇒ Object
221
222
223
|
# File 'lib/logstash/filters/base.rb', line 221
def close
end
|
#do_filter(event, &block) ⇒ Object
143
144
145
146
147
|
# File 'lib/logstash/filters/base.rb', line 143
def do_filter(event, &block)
time = java.lang.System.nanoTime
filter(event, &block)
@slow_logger.on_event("event processing time", @original_params, event, java.lang.System.nanoTime - time)
end
|
#execute(event, &block) ⇒ Object
171
172
173
|
# File 'lib/logstash/filters/base.rb', line 171
def execute(event, &block)
do_filter(event, &block)
end
|
#filter(event) ⇒ Object
138
139
140
|
# File 'lib/logstash/filters/base.rb', line 138
def filter(event)
raise "#{self.class}#filter must be overidden"
end
|
#multi_filter(events) ⇒ Object
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/logstash/filters/base.rb', line 158
def multi_filter(events)
LogStash::Util.set_thread_plugin(self)
result = []
events.each do |event|
unless event.cancelled?
result << event
do_filter(event){|new_event| result << new_event}
end
end
result
end
|
#register ⇒ Object
133
134
135
|
# File 'lib/logstash/filters/base.rb', line 133
def register
raise "#{self.class}#register must be overidden"
end
|
#threadsafe? ⇒ Boolean
176
177
178
|
# File 'lib/logstash/filters/base.rb', line 176
def threadsafe?
@threadsafe
end
|