Filebeat 配置文件性能优化要点
一 核心思路与适用场景
二 关键参数与建议值
输入 Input
队列 Queue
输出 Output(以 Elasticsearch 为例)
处理与资源
三 示例配置片段
# filebeat.yml 示例(按需取值)
filebeat.inputs:
- type: filestream
paths:
- /var/log/*.log
harvester_buffer_size: 41943040 # 40 MiB
harvester.max_bytes: 1048576 # 1 MiB
max_concurrent_files: 1024
scan_frequency: 15s
ignore_older: 168h
close_inactive: 2h
queue:
mem:
events: 8192
flush:
min_events: 2048
timeout: 1s
# 可选:磁盘队列(高可靠/背压场景)
# spool:
# file:
# path: ${path.data}/spool.dat
# size: 536870912 # 512 MiB
# page_size: 16384 # 16 KiB
# prealloc: true
output.elasticsearch:
hosts: ["http://es-node:9200"]
worker: 3 # 约等于 ES 数据节点数
bulk_max_size: 15000
flush_interval: 1s
compression: gzip
processors:
# 仅做必要处理,避免复杂 Grok
- add_host_metadata: ~
- add_cloud_metadata: ~
四 调优步骤与监控