# Formatter Plugins

Fluentd has nine (9) types of plugins:

* [Input](https://docs.fluentd.org/input)
* [Parser](https://docs.fluentd.org/parser)
* [Filter](https://docs.fluentd.org/filter)
* [Output](https://docs.fluentd.org/output)
* [Formatter](https://docs.fluentd.org/formatter)
* [Storage](https://docs.fluentd.org/storage)
* [Service Discovery](https://docs.fluentd.org/service_discovery)
* [Buffer](https://docs.fluentd.org/buffer)
* [Metrics](https://docs.fluentd.org/metrics)

This article gives an overview of the Formatter Plugin.

## Overview

Sometimes, the output format for an output plugin does not meet one's needs. Fluentd has a pluggable system called Formatter that lets the user extend and reuse custom output formats.

## How To Use

For an output plugin that supports Formatter, the `<format>` directive can be used to change the output format.

For example, by default, [`out_file`](https://docs.fluentd.org/output/file) plugin outputs data as

```
2014-08-25 00:00:00 +0000<TAB>foo.bar<TAB>{"k1":"v1", "k2":"v2"}
```

However, if you set `@type json` in `<format>` like this:

```
<match foo.bar>
  @type file
  path /path/to/file
  <format>
    @type json
  </format>
</match>
```

The output changes to

```javascript
{"k1":"v1", "k2":"v2"}
```

i.e., each line is a single JSON object without "time" and "tag" fields. If you want to include "time" and "tag", use [Inject section](https://docs.fluentd.org/configuration/inject-section).

See [this section](https://docs.fluentd.org/plugin-development#text-formatter-plugins) to learn how to develop a custom formatter.

## List of Built-in Formatters

* [`out_file`](https://docs.fluentd.org/formatter/out_file)
* [`json`](https://docs.fluentd.org/formatter/json)
* [`ltsv`](https://docs.fluentd.org/formatter/ltsv)
* [`csv`](https://docs.fluentd.org/formatter/csv)
* [`msgpack`](https://docs.fluentd.org/formatter/msgpack)
* [`hash`](https://docs.fluentd.org/formatter/hash)
* [`single_value`](https://docs.fluentd.org/formatter/single_value)
* [`tsv`](https://docs.fluentd.org/formatter/tsv)

## List of Output/Filter Plugins with Formatter Support

* [`filter_stdout`](https://docs.fluentd.org/filter/stdout)
* [`out_file`](https://docs.fluentd.org/output/file)
* [`out_s3`](https://docs.fluentd.org/output/s3)

If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is an open-source project under [Cloud Native Computing Foundation (CNCF)](https://cncf.io/). All components are available under the Apache 2 License.
