Logging

This article describes Fluentd's logging mechanism.

Fluentd has two log layers: global and per plugin. Different log levels can be set for global logging and plugin level logging.

Log Level

Shown below is the list of supported values, in increasing order of verbosity:

  • fatal

  • error

  • warn

  • info

  • debug

  • trace

The default log level is info, and Fluentd outputs info, warn, error and fatal logs by default.

Global Logs

Global logging is used by Fluentd core and plugins that don't set their own log levels. The global log level can be adjusted up or down.

By Command Line Option

Increase Verbosity Level

The -v option sets the verbosity to debug while the -vv option sets the verbosity to trace.

These options are useful for debugging purposes.

Decrease Verbosity Level

The -q option sets the verbosity to warn while the -qq option sets the verbosity to error.

By Config File

You can also change the logging level with <system> section in the config file like below.

Per Plugin Log

The log_level option sets different levels of logging for each plugin. It can be set in each plugin's configuration file.

For example, in order to debug in_tail but suppress all but fatal log messages for in_http, their respective log_level options should be set as follows:

If you don't specify the log_level parameter, the plugin will use the global log level. Some plugins haven't supported per-plugin logging yet. The logging section of the Plugin Development article explains how to update such plugins to support the new log level system.

Suppress repeated stacktrace

Fluentd can suppress same stacktrace with --suppress-repeated-stacktrace. For example, if you pass --suppress-repeated-stacktrace to fluentd:

logs are changed to:

Same stacktrace is replaced with suppressed same stacktrace message until other stacktrace is received.

Output to log file

Fluentd outputs logs to STDOUT by default. To output to a file instead, please specify the -o option.

Fluentd doesn't support log rotation yet.

Capture Fluentd logs

Fluentd marks its own logs with the fluent tag. You can process Fluentd logs by using <match fluent.**> or <match **>(Of course, ** captures other logs). If you define <match fluent.**> in your configuration, then Fluentd will send its own logs to this match destination. This is useful for monitoring Fluentd logs.

For example, if you have the following <match fluent.**>:

then Fluentd outputs fluent.info logs to stdout like below:

Case1: Send Fluentd logs to monitoring service

You can send Fluentd logs to a monitoring service by plugins, e.g. datadog, sentry, irc, etc.

Case2: Use aggregation/monitoring server

You can use out_forward to send Fluentd logs to a monitoring server. The monitoring server can then filter and send the logs to your notification system: chat, irc, etc.

Leaf server example:

Monitoring server example:

If an error occurs, you will get a notification message in your irc notify channel.

If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is a open source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.

Last updated

Was this helpful?