Class: Fluent::Filter
- Inherits:
-
Object
- Object
- Fluent::Filter
- Includes:
- Configurable, PluginId, PluginLoggerMixin
- Defined in:
- lib/fluent/filter.rb
Direct Known Subclasses
GrepFilter, ParserFilter, RecordTransformerFilter, StdoutFilter
Constant Summary
Constants included from Configurable
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary collapse
-
#router ⇒ Object
Returns the value of attribute router.
Attributes included from PluginLoggerMixin
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #filter(tag, time, record) ⇒ Object
- #filter_stream(tag, es) ⇒ Object
-
#initialize ⇒ Filter
constructor
A new instance of Filter.
- #shutdown ⇒ Object
- #start ⇒ Object
Methods included from PluginLoggerMixin
Methods included from PluginId
Methods included from Configurable
#config, included, lookup_type, register_type
Constructor Details
#initialize ⇒ Filter
Returns a new instance of Filter.
31 32 33 |
# File 'lib/fluent/filter.rb', line 31 def initialize super end |
Instance Attribute Details
#router ⇒ Object
Returns the value of attribute router.
29 30 31 |
# File 'lib/fluent/filter.rb', line 29 def router @router end |
Instance Method Details
#configure(conf) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fluent/filter.rb', line 35 def configure(conf) super if label_name = conf['@label'] label = Engine.root_agent.find_label(label_name) @router = label.event_router elsif @router.nil? @router = Engine.root_agent.event_router end end |
#filter(tag, time, record) ⇒ Object
52 53 54 |
# File 'lib/fluent/filter.rb', line 52 def filter(tag, time, record) raise NotImplementedError, "Implement this method in child class" end |
#filter_stream(tag, es) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fluent/filter.rb', line 56 def filter_stream(tag, es) new_es = MultiEventStream.new es.each { |time, record| begin filtered_record = filter(tag, time, record) new_es.add(time, filtered_record) if filtered_record rescue => e router.emit_error_event(tag, time, record, e) end } new_es end |
#shutdown ⇒ Object
49 50 |
# File 'lib/fluent/filter.rb', line 49 def shutdown end |
#start ⇒ Object
46 47 |
# File 'lib/fluent/filter.rb', line 46 def start end |