linux

Filebeat配置文件怎样优化性能

小樊
35
2025-11-25 01:52:46
栏目: 编程语言

Filebeat 配置文件性能优化要点

一 核心思路与适用场景

二 关键参数与建议值

三 示例配置片段

# 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: ~

四 调优步骤与监控

0
看了该问题的人还看了