> For the complete documentation index, see [llms.txt](https://docs.fluentd.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fluentd.org/0.12/filter.md).

# Filter Plugins

Fluentd has 6 types of plugins: [Input](/0.12/input.md), [Parser](/0.12/parser.md), [Filter](/0.12/filter.md), [Output](/0.12/output.md), [Formatter](/0.12/formatter.md) and [Buffer](/0.12/buffer.md). This article gives an overview of Filter Plugin.

## Overview

Filter plugins enables Fluentd to modify event streams. Example use cases are:

1. Filtering out events by grepping the value of one or more fields.
2. Enriching events by adding new fields.
3. Deleting or masking certain fields for privacy and compliance.

## How to Use

It is used with the `<filter>` directive as follows:

```
<filter foo.bar>
  @type grep
  regexp1 message cool
</filter>
```

The above directive matches events with the tag "foo.bar", and if the "message" field's value contains "cool", the events go through the rest of the configuration.

Like the `<match>` directive for output plugins, `<filter>` matches against a tag. Once the event is processed by the filter, the event proceeds through the configuration top-down. Hence, if there are multiple filters for the same tag, they are applied in descending order. Hence, in the following example,

```
<filter foo.bar>
  @type grep
  regexp1 message cool
</filter>

<filter foo.bar>
  @type record_transformer
  <record>
    hostname "#{Socket.gethostname}"
  </record>
</filter>
```

Only the events whose "message" field contain "cool" get the new field "hostname" with the machine's hostname as its value.

Users can create their own custom plugins with a bit of Ruby. See [this section](/0.12/developer/plugin-development.md#filter-plugins) for more information.

## List of Filter Plugins

* [grep](/0.12/filter/grep.md)
* [record-transformer](/0.12/filter/record_transformer.md)
* [filter\_stdout](/0.12/filter/stdout.md)

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 a open source project under [Cloud Native Computing Foundation (CNCF)](https://cncf.io/). All components are available under the Apache 2 License.
