CentOS Filebeat自定义配置文件解析

Filebeat 是一个轻量级的日志收集器,用于将日志文件或日志流发送到 Elasticsearch 或 Logstash 进行存储和分析

  1. filebeat.inputs: 定义 Filebeat 要监视的输入文件或目录。例如:
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/*.log
  1. filebeat.modules: 启用和配置 Filebeat 模块。模块可以帮助您自动收集特定应用程序的日志。例如:
filebeat.modules:
  path: ${config.home}/modules.d/*.yml
  reload.enabled: false
  1. filebeat.processors: 定义在发送日志之前要应用的处理器。例如,可以使用 add_fields 处理器为事件添加自定义字段:
filebeat.processors:
- add_fields:
    fields:
      custom_field: "my_custom_value"
  1. filebeat.output.elasticsearch: 配置 Filebeat 将日志发送到 Elasticsearch 的设置。例如:
filebeat.output.elasticsearch:
  hosts: ["localhost:9200"]
  index: "filebeat-%{[agent.version]}-%{+yyyy.MM.dd}"
  1. filebeat.setup.template.settings: 定义 Elasticsearch 索引模板设置。例如:
filebeat.setup.template.settings:
  index.number_of_shards: 3
  index.codec: best_compression
  _source.enabled: true
  1. filebeat.setup.ilm.enabled: 启用 Index Lifecycle Management (ILM)。例如:
filebeat.setup.ilm.enabled: true
filebeat.setup.ilm.template_name: "filebeat"
filebeat.setup.ilm.pattern: "filebeat-*"
filebeat.setup.ilm.policy_name: "delete"

这只是 Filebeat 配置文件的一部分示例。您可以根据需要添加更多配置选项。要查看完整的配置选项,请参阅 Filebeat 官方文档:https://www.elastic.co/guide/en/beats/filebeat/current/configuration-file.html

Both comments and pings are currently closed.

Comments are closed.

Powered by KingAbc | 粤ICP备16106647号-2 | Loading Time‌ 1.168