filebeat 常见的inputs、outputs总结
inputs
log
sdtin
- type: stdin
redis slowlog
- type: redis
enabled: true
hosts: ["localhost:6379"]
password: foobared
## How often the input checks for redis slow log.
#scan_frequency: 10s
## Timeout after which time the input should return an error
#timeout: 1s
## Network type to be used for redis connection. Default: tcp
#network: tcp
## 最大并发连接数。默认值:10
#maxconn: 10
udp
- type: udp
enabled: true
#host: 'localhost:8080'
##通过UDP接收的消息的最大大小
#max_message_size: 10KiB
##UDP读取缓冲区的大小(以字节为单位)
#read_buffer: 0
tcp
- type: tcp
enabled: true
## The host and port to receive the new event
#host: "localhost:9000"
## Character used to split new message
#line_delimiter: "\n"
##通过TCP接收消息的最大字节
#max_message_size: 20MiB
##最大并发链接数,0表示无限制。默认:0
#max_connections: 0
##多久关闭处于非活动状态的链接。
#timeout: 300s
syslog
# Experimental: Config options for the Syslog input
# Accept RFC3164 formatted syslog event via UDP.
#- type: syslog
#enabled: false
#protocol.udp:
# The host and port to receive the new event
#host: "localhost:9000"
# Maximum size of the message received over UDP
#max_message_size: 10KiB
# Accept RFC3164 formatted syslog event via TCP.
#- type: syslog
#enabled: false
#protocol.tcp:
# The host and port to receive the new event
#host: "localhost:9000"
# Character used to split new message
#line_delimiter: "\n"
# Maximum size in bytes of the message received over TCP
#max_message_size: 20MiB
# The number of seconds of inactivity before a remote connection is closed.
#timeout: 300s
outputs
logstash
output.logstash:
enabled: true
hosts: ["127.0.0.1:5044"]
# Number of workers per Logstash host.
worker: 1
# Optionally load-balance events between Logstash hosts. Default is false.
#loadbalance: false
# Number of batches to be sent asynchronously to Logstash while processing new batches.
#pipelining: 2
##网络错误后尝试重新连接到Logstash之前等待的秒数。
#backoff.init: 1s
#网络错误后尝试连接到Logstash之前等待的最大秒数。默认值为60秒。
#backoff.max: 60s
##可选索引名称。默认索引名设置为filebeat,全部小写。
#index: 'filebeat'
##发布失败后重试发布事件的次数。
#max_retries: 3
##单个Logstash请求中要批量处理的最大事件数。默认值为2048。
#bulk_max_size: 2048
elasticsearch
output.elasticsearch:
enabled: true
hosts: ["localhost:9200"]
##协议 - either `http` (default) or `https`.
#protocol: "https"
##身份验证凭据-API密钥或用户名/密码
api_key: "id:api_key"
username: "elastic"
password: "changeme"
##通过索引操作在URL中传递的HTTP参数字典
#parameters:
#param1: value1
#param2: value2
# Number of workers per Elasticsearch host.
#worker: 1
##可选索引名称。默认值是“filebeat”加上日期并生成[filebeat-]年月日。
#index: "filebeat-%{[agent.version]}-%{+yyyy.MM.dd}"
# Optional ingest node pipeline. By default no pipeline will be used.
#pipeline: ""
# Optional HTTP path
#path: "/elasticsearch"
##要添加到每个请求的自定义HTTP头
#headers:
# X-My-Header: Contents of the header
##尝试索引操作的重试次数。如果索引操作在多次重试后没有成功,则事件将被删除。默认值为3。
#max_retries: 3
#单个Elasticsearch批量API索引请求中要批量处理的最大事件数。默认值为50。
#bulk_max_size: 50
##网络错误后尝试重新连接到Elasticsearch之前等待的秒数
#backoff.init: 1s
##网络错误后尝试连接到Elasticsearch之前等待的最大秒数。默认值为60秒。
#backoff.max: 60s
##在请求Elasticsearch失败之前配置HTTP请求超时。
#timeout: 90
kafka
file
output.file:
enabled: true
codec.json:
pretty: true
escape_html: true
path: "/data/logs/filebeat"
filename: filebeat_output.log
rotate_every_kb: 10000
number_of_files: 7
permissions: 0600
redis
output.redis:
enabled: true
codec.json:
pretty: false
escape_html: false
hosts: ["localhost:6379"]
key: filebeat
password: '*****'
db: 0
##发布事件的Redis数据类型。如果数据类型为list,则使用RPUSH命令;如果数据类型为channel,则使用PUBLISH命令。默认值为list。
datatype: list
##发布事件到每个Redis的工作线程数。将此设置与loadbalance选项一起使用。例如,如果有2台主机和3台工作机,则总共启动6台工作机(每个主机3台)。
worker: 1
#如果设置为true并且配置了多个hosts或worker,则会将发布的事件负载平衡到所有Redis主机上。
#如果设置为false,则只向一个主机发送所有事件(随机确定),如果当前选定的主机无法访问,则将切换到另一个主机。
#默认值为true。
loadbalance: true
timeout: 5s
##发布失败后重试发布事件的次数。在指定的重试次数之后,通常会删除事件。
max_retries: 3
##网络错误后等待多久尝试重新连接到Redis。
backoff.init: 1s
##网络错误后尝试连接到Redis之前等待的最大秒数。默认值为60秒。
#backoff.max: 60s
#单个Redis请求或管道中要批量处理的最大事件数。默认值为2048。
bulk_max_size: 2048
console
output.console:
enabled: true
codec.json:
pretty: false
escape_html: false
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能