Fluent::Plugin::Base
in Fluentd v1 or later. The Base
class has some features and methods that provide the basic mechanism as plugins. This page shows these methods provided by Fluent::Plugin::Base
, and other methods provided commonly in some type of plugins.Base
class provides methods to create configurable parameters for plugins. It also supports methods to provide system configurations to plugins..config_param(name, type = nil, **options, &block)
name
: the parameter name as a symboltype
: the parameter typeoptions
: the options for the parameterblock
: if given, convert the value via the given block.config_set_default(name, default_value)
name
. If the default value already exists, it raises ArgumentError
.name
: The name of the parameter.default_value
: Default value of the parameter..config_set_desc(name, description)
name
. If the description already exists, it raises ArgumentError
. For internal use only! Use desc
instead.name
: The name of the parameter.description
: Description of the parameter..desc(description)
description
: Description of the parameter..config_section(name, **options, &block)
name
: The name of the section.options
:root
: If true
, this section is the root section. For internal use only!param_name
: The section name.final
: If true
, the subclass of this class cannot override this section.init
: If true
, the parameters in this section must have default values.required
: If true
, the section is required. Fluentd will raiseFluent::ConfigError
if the section is missing.multi
: If true
, users can configure this section multiple times.alias
: Alias for this section..configured_in(section_name)
section_name
defined in the super class.section_name
: The section name as Symbol..system_config
Fluent::SystemConfig
instance..system_config_override(options = {})
options
: The system configuration as Hash.#initialize
super
if the plugin overrides this method.#configure(conf)
conf
parameter is an instance of Fluent::Config::Element
. Call super
if the plugin overrides this method. Fluentd's Configurable module (included in Base class) will traverse conf
object, and set values from configurations or default values into the instance variables in super
. So, the instance variables or accessor methods are available after super
in #configure
method.super
.#log
Fluent::Log
instance.trace
debug
info
warn
error
fatal
#has_router?
#router
method exists or not. (default: false
)event_emitter
plugin helper, this method will return true
.event_emitter
by default.#start
super
if the plugin overrides this method.super
. Many of these may be provided as plugin helpers. See API details of each plugin helper.#stop
super
if the plugin overrides this method.super
should be called at last in methods of shutdown sequence: stop
, before_shutdown
, shutdown
, after_shutdown
, close
and terminate
.#before_shutdown
#stop
and before #shutdown
. It may be used to control the flushing of buffered events in the shutdown sequence.super
if the plugin overrides this method. The third-party plugins do not need to implement this method in most cases.#shutdown
super
if the plugin overrides this method.#after_shutdown
#shutdown
. It is used to control the emitting of events in shutdown sequence.super
if the plugin overrides this method. Third-party plugins do not need to implement this method in most cases.#close
#shutdown
.super
if the plugin overrides this method.#terminate
super
if the plugin overrides this method..helpers(*symbols)
#register_
) to show what plugin helpers this plugin uses explicitly.#plugin_id
#plugin_id_configured?
#plugin_id
is configured by users or not.