fluentd filter插件(v0.12)

本文介绍了Fluentd的过滤插件功能,包括如何使用过滤插件修改事件流,例如通过过滤、丰富或删除字段来满足特定需求。文中还列举了常用的过滤插件类型。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://docs.fluentd.org/v0.12/articles/filter-plugin-overview

Fluentd has 6 types of plugins: InputParserFilterOutputFormatter and Buffer. This article gives an overview of Filter Plugin.

Table of Contents

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 for more information.

List of Filter Plugins


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值