「Fluentd」- 配置文件(学习笔记)

学习方法

学习目标:1)理解 Fluentd 概念;2)熟悉工作原理;3)理解配置文件;
方法途径:阅读 Fluentd 1.0 文档的 Overview Installation Configuration Deployment Container Deployment 部分

配置文件路径

对于 td-agent 部署,配置文件路径:/etc/td-agent/td-agent.conf

配置文件指令

source,输入源

filter,过滤并处理输入

match,输出,目标位置,日志将要写入的位置

system,用于控制服务的变量

label,用于合并 filter 与 match 指令,然后在 source 中使用该 label 名称。

为什么使用 label 指令
1)使用 filter 与 match 指令,需要关注顺序。通过 label 可以避免出现配置错误。
2)将配置“块化”,便于维护与管理;

@include,用于引入配置文件

相关文档

Fluentd 1.0/Routing Examples
路由示例,决定数据最后流向哪里

Fluentd 1.0/Config: Common Parameters
公共的配置参数

Fluentd 1.0/Config: Parse Section
处理原始数据,操纵、生成特定格式的 Event 数据。

Fluentd 1.0/Config: Buffer Section
配置缓冲,将 Event 以块为单位进行处理。

Fluentd 1.0/Config: Format Section
修改 Record 格式,使用 JSON、CVS 等格式输出。

Fluentd 1.0/Config: Config: Inject Section
用于向 Recode 中注入数据。

Fluentd 1.0/Config: Extract Section
用于从 Record 中提取数据。

Fluentd 1.0/Config: Transport Section
某些插件,比如 server/http_server 支持 transport 部分,可以指定 udp tcp tls 等等。

Fluentd 1.0/Storage Plugins
用于保存插件状态

Fluentd 1.0/Config: Service Discovery Section
通过配置文件、SRV 等等方式,实时获取访问目标,而无需重启。

参考文献

Fluentd 1.0/Config File Syntax