温馨提示×

centos filebeat支持哪些输出

小樊
53
2026-08-18 20:52:58
栏目: 智能运维

CentOS 上运行的 Filebeat 支持的输出(Output)类型与 Filebeat 官方版本一致,和操作系统关系不大。下面按常见场景给你一个完整说明。


一、Filebeat 支持的主要输出类型

1. Elasticsearch(最常用)

直接把日志发送到 Elasticsearch 集群。

output.elasticsearch:
  hosts: ["http://localhost:9200"]
  username: "elastic"
  password: "changeme"

✅ 支持:

  • Elasticsearch 6.x / 7.x / 8.x
  • 安全认证(用户名/密码、API Key)
  • HTTPS / TLS

2. Logstash

通过 Logstash 做日志预处理后再输出。

output.logstash:
  hosts: ["localhost:5044"]

✅ 常用于:

  • 日志过滤、解析(grok、mutate)
  • 多路输出

3. Kafka

将日志发送到 Kafka 消息队列。

output.kafka:
  hosts: ["localhost:9092"]
  topic: "filebeat-logs"

✅ 适合:

  • 高并发日志
  • 解耦采集与消费

4. Redis

输出到 Redis(List / Channel)。

output.redis:
  hosts: ["localhost:6379"]
  key: "filebeat"
  db: 0

✅ 常用于:

  • 临时缓冲
  • 防止日志丢失

5. File(文件输出)

将日志写入本地文件(调试用)。

output.file:
  path: "/tmp/filebeat-output"
  filename: "filebeat"

⚠️ 不建议生产环境使用


6. Console(控制台输出)

直接输出到标准输出。

output.console:
  pretty: true

✅ 常用于:

  • 调试配置
  • 验证日志格式

7. Elastic Cloud

直接输出到 Elastic Cloud(SaaS)。

output.elasticcloud:
  url: "https://xxxx.cloud.es.io"
  username: "elastic"
  password: "xxxx"

二、不支持或已废弃的输出(注意)

输出类型 状态
Elasticsearch 2.x / 5.x 已不支持
Output to syslog ❌ 不支持
Output to MySQL / MongoDB ❌ 不支持

三、CentOS 上的注意事项

1️⃣ Filebeat 版本与输出能力无关

  • CentOS 7 / 8 / Stream 都支持上述输出
  • 关键是 Filebeat 版本,不是 CentOS 版本

查看版本:

filebeat version

2️⃣ 同时只能启用一个输出

Filebeat 不支持同时启用多个 output

❌ 错误示例:

output.elasticsearch:
  ...
output.logstash:
  ...

✅ 正确方式:

  • Logstash 做多路输出
  • 或运行 多个 Filebeat 实例

3️⃣ 常见组合推荐

场景 推荐输出
ELK 架构 Elasticsearch
日志复杂解析 Logstash
高并发 Kafka
临时缓冲 Redis
调试 Console / File

四、示例:CentOS 上查看支持的输出

filebeat export config

或查看配置模板:

filebeat modules list

如果你愿意,可以告诉我:

  • ✅ Filebeat 版本
  • ✅ CentOS 版本
  • ✅ 日志最终要存到哪里(ES / Kafka / 本地)

我可以帮你直接写一份 可用的 filebeat.yml 配置

0