The event_emitter
plugin helper introduces the router
method to the plugin.
Here is an example:
require 'fluent/plugin/output'​module Fluent::Pluginclass RelabelOutput < OutputFluent::Plugin.register_output('relabel', self)helpers :event_emitter​def multi_workers_ready?trueend​def process(tag, es)router.emit_stream(tag, es)endendend
This method returns a Fluent::EventRouter
instance.
Code example:
# emit eventrouter.emit(tag, time, record)​# emit event streamrouter.emit_stream(tag, es)​# emit error eventbegin# do somethingrescue => error# Route event to @ERROR label or# log error message when @ERROR label is not defined in configurationrouter.emit_error_event(tag, time, record, error)end
All input plugins
All filter plugins
​out_exec
​
​out_relabel
​
​out_copy
​
​out_roundrobin
​
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.