Configuration Parameter Types

Types of Configuration Parameters

Common Options

  • default: Specifies the default value for a parameter. If omitted, the

    parameter is required. On startup, Fluentd uses the default value instead if

    the parameter is not configured.

    NOTE: It doesn't perform type conversion such as time type, and the specified default value is used as is.

# Required parameter: The configuration must have this parameter like 'param1 10'.
config_param :param1, :integer

# Optional parameter: If the configuration doesn't have 'param2', 100 is used.
config_param :param2, :integer, default: 100
  • secret: If true, the parameter will be masked when Fluentd dumps its

    configuration on the standard output on startup.

config_param :secret_param, :string, secret: true
  • deprecated: Specifies the deprecation warning message. If users use this

    parameter in the configuration, they will see the deprecation warning on

    startup.

  • obsoleted: Specifies the obsolete error message. If users use this parameter

    in the configuration, Fluentd raises Fluent::ConfigError and stops.

  • alias: Alias for this parameter as a symbol.

  • skip_accessor: If true, skip adding accessor to the plugin. For internal

    use only!

Data Types

:string

Defines a string parameter.

Code Example:

Configuration Example:

:regexp

Defines a regexp parameter. Since v1.2.0.

Code Example:

Configuration Example:

:integer

Defines an integer parameter.

Code Example:

Configuration Example:

:float

Defines a float parameter.

Code Example:

Configuration Example:

:size

Defines a size parameter in bytes.

Available suffixes: { k, m, g, t } (ignore case)

Code Example:

Configuration Example:

Configuration Example:

:time

Defines the length of the time parameter.

Available suffixes: { s, m, h, d } (lower case only).

If omitted, to_f is applied to the value which converts it to seconds.

Code Example:

Configuration Example:

Configuration Example:

:bool

Defines a Boolean parameter.

Code Example:

Configuration Example:

:enum

Defines an enumerated parameter.

Users can choose a value from the list. If a non-listed value is chosen, an error occurs on startup.

  • Available options

    • list: List of available values.

Code Example:

Configuration Example:

:array

Defines an array parameter.

Users can set an array value for a parameter.

  • Available options

    • value_type: Defines the type of the value.

      Available types: { :string, :integer, :float, :size, :bool, :time }

Code Example:

Configuration Example:

This configuration will be converted to:

:hash

Defines a hash parameter.

  • Available options

    • symbolize_keys: If true, the keys are symbolized.

    • value_type: Defines the same type for all values.

Code Example:

Configuration Example:

This configurations will be converted to:

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.

Last updated

Was this helpful?