How to Write Base Plugin
All plugin types are subclasses of
Fluent::Plugin::Basein Fluentd v1 or later. The
Baseclass 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.
The methods listed below are considered as public methods, and will be maintained not to break compatibility. Other methods may be changed without compatibility consideration.
require 'fluent/plugin/input' # This may be input, filter, output, parser, formatter, storage or buffer.
class MyExampleInput < Input
# Plugins should be registered by calling `Fluent::Plugin.register_TYPE` method with name and `self`.
# The first argument String is to identify the plugin in the configuration file.
# The second argument is class of the plugin itself, `self` in most cases.
desc 'The port number'
# `config_param` Defines a parameter. You can refer the following parameter via @port instance variable.
# Without `:default`, a parameter is required.
config_param :port, :integer