githubEdit

Fluentd

Fluentd and Fluent Bit

Fluentd

Introduction

...

Deploy By Binary

Quick Start

# Ubuntu Package install
# https://docs.fluentd.org/installation/install-by-deb

Config and Boot

Fluentd Config

# change storage permission
# td-agent
chown td-agent.td-agent /opt/log_path/ -R
# fluentd
chown _fluentd:_fluentd /opt/log_path/ -R

# boot
systemctl daemon-reload
systemctl start td-agent.service
systemctl enable td-agent.service

Verify

Troubleshooting

Deploy By Container

Run On Kubernetes

Fluent Bit

Introduction

Fluent Bit 是一个开源的多平台日志处理器工具,它旨在成为用于日志处理和分发的通用利器。 如今,系统中信息源数量正在不断增加。处理大规模数据非常复杂,收集和汇总各种数据需要一种专门的工具,该工具可以解决如下问题:

  • 不同的数据源

  • 不同的数据格式

  • 数据可靠性

  • 安全性

  • 灵活的路由

  • 多目的地 Fluent Bit 在设计时就考虑了高性能和低资源消耗。

Fluent Bit & Fluentd 区别 Fluentd 和 Fluent Bit 都可以充当聚合器或转发器,它们可以互补使用或单独用作为解决方案。详情arrow-up-right

Deploy By Binary

Deploy By Container

相关概念

Kubernetes 管理 nodes 集群,因此我们的日志代理工具需要在每个节点上运行以从每个 POD 收集日志,因此 Fluent Bit 被部署为 DaemonSet(在集群的每个 node 上运行的 POD)。 当 Fluent Bit 运行时,它将读取,解析和过滤每个 POD 的日志,并将使用以下信息(元数据)丰富每条数据:

  • Pod Name

  • Pod ID

  • Container Name

  • Container ID

  • Labels

  • Annotations

日志输出方式

当前集群环境容器日志都为 console 输出,分为两部分:

  • 输出到 Elasticsearch,用于 Kibana 前台搜索日志。

  • 输出到 forward 接口,接口由 fluentd 服务提供并持久化日志,本地存储15天,归档3个月日志到云存储(如 S3、GCS、OSS 等)。

helm 下载 charts 包

配置启动

快速部署 fluent-bit & es 服务(仅用于测试环境)

OUTPUT 插件服务相关配置

Elasticsearch 配置

Logstash 配置

Reference:

Last updated