https://www.fluentd.org
https://docs.fluentd.org
https://docs.fluentbit.io/manual
https://github.com/kubesphere-sigs/fluent-operator-walkthrough
Fluent Operator
Fluent Operator 为 Fluent Bit 和 Fluentd 分别定义了两个 Group:
fluentbit.fluent.io
fluentd.fluent.io
fluentbit.fluent.io 分组下包含以下 6 个 CRDs:
- Fluentbit CRD 定义了 Fluent Bit 的属性,比如镜像版本、污点、亲和性等参数。
- ClusterFluentbitConfig CRD 定义了 Fluent Bit 的配置文件。
- ClusterInput CRD 定义了 Fluent Bit 的 input 插件,即输入插件。通过该插件,用户可以自定义采集何种日志。
- ClusterFilter CRD 定义了 Fluent Bit 的 filter 插件,该插件主要负责过滤以及处理 fluentbit 采集到的信息。
- ClusterParser CRD 定义了 Fluent Bit 的 parser 插件,该插件主要负责解析日志信息,可以将日志信息解析为其他格式。
- ClusterOutput CRD 定义了 Fluent Bit 的 output 插件,该插件主要负责将处理后的日志信息转发到目的地。
fluentd.fluent.io 分组下包含以下 7 个 CRDs:
- Fluentd CRD 定义了 Fluentd 的属性,比如镜像版本、污点、亲和性等参数。
- ClusterFluentdConfig CRD 定义了 Fluentd 集群级别的配置文件。
- FluentdConfig CRD 定义了 Fluentd 的 namespace 范围的配置文件。
- ClusterFilter CRD 定义了 Fluentd 集群范围的 filter 插件,该插件主要负责过滤以及处理 Fluentd 采集到的信息。如果安装了 Fluent Bit,则可以更进一步的处理日志信息。
- Filter CRD 该 CRD 定义了 Fluentd namespace 的 filter 插件,该插件主要负责过滤以及处理 Fluentd 采集到的信息。如果安装了 Fluent Bit,则可以更进一步的处理日志信息。
- ClusterOutput CRD 该 CRD 定义了 Fluentd 的集群范围的 output 插件,该插件主要负责将处理后的日志信息转发到目的地。
- Output CRD 该 CRD 定义了 Fluentd 的 namespace 范围的 output 插件,该插件主要负责将处理后的日志信息转发到目的地。
Fluent Bit only 模式:如果您只需要在收集日志并在简单处理后将日志发送到最终目的地,您只需要 Fluent Bit。
Fluentd only 模式:如果需要通过网络以 HTTP 或 Syslog 等方式接收日志,然后将日志处理并发送到最终的目的地,则只需要 Fluentd。
Fluent Bit + Fluentd 模式:如果你还需要对收集到的日志进行一些高级处理或者发送到更多的 sink,那么你可以组合使用 Fluent Bit 和 Fluentd。
在 Fluent Bit CRD 中每个 ClusterInput, ClusterParser, ClusterFilter,ClusterOutput 代表一个 Fluent Bit 配置部分,由 ClusterFluentBitConfig 标签选择器选择
Fluent Operator vs logging-operator
- 两者皆可自动部署 Fluent Bit 与 Fluentd。logging-operator 需要同时部署 Fluent Bit 和 Fluentd,而 Fluent Operator 支持可插拔部署 Fluent Bit 与 Fluentd,非强耦合,用户可以根据自己的需要自行选择部署 Fluentd 或者是 Fluent Bit,更为灵活。
- 在 logging-operator 中 Fluent Bit 收集的日志都必须经过 Fluentd 才能输出到最终的目的地,而且如果数据量过大,那么 Fluentd 存在单点故障隐患。Fluent Operator 中 Fluent Bit 可以直接将日志信息发送到目的地,从而规避单点故障的隐患。
- logging-operator 定义了 loggings,outputs,flows,clusteroutputs 以及 clusterflows 四种 CRD,而 Fluent Operator 定义了 13 种 CRD。相较于 logging-operator,Fluent Operator 在 CRD 定义上更加多样,用户可以根据需要更灵活的对 Fluentd 以及 Fluent Bit 进行配置。同时在定义 CRD 时,选取与 Fluentd 以及 Fluent Bit 配置类似的命名,力求命名更加清晰,以符合原生的组件定义。
- 两者均借鉴了 Fluentd 的 label router 插件实现多租户日志隔离。
fluent-operator-walkthrough:
https://github.com/kubesphere-sigs/fluent-operator-walkthrough
Fluent Bit Only 模式
Fluent Bit Only 将只启用轻量级的 Fluent Bit 对日志进行采集、处理以及转发
Fluent Bit + Fluentd 模式
凭借 Fluentd 丰富的插件,Fluentd 可以充当日志聚合层,执行更高级的日志处理。您可以使用 Fluent Operator 轻松地将日志从 Fluent Bit 转发到 Fluentd
Fluentd Only 模式
该模式只会部署 Fluentd statefulset
Fluent Operator:云原生日志管理的一把瑞士军刀
初始化任务 定义日志配置