Formatter Plugins
Sometimes, the output format for an output plugin does not meet one's needs. Fluentd has a pluggable system called Text Formatter that lets the user extend and re-use custom output formats.
For an output plugin that supports Text Formatter, the
format
parameter can be used to change the output format.2014-08-25 00:00:00 +0000<TAB>foo.bar<TAB>{"k1":"v1", "k2":"v2"}
However, if you set
format json
like this<match foo.bar>
@type file
path /path/to/file
format json
</match>
The output changes to
{"time": "2014-08-25 00:00:00 +0000", "tag":"foo.bar", "k1:"v1", "k2":"v2"}
i.e., each line is a single JSON object with "time" and "tag fields to retain the event's timestamp and tag.
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 modified 4yr ago