ubuntu

ubuntu上如何自定义filebeat配置文件

小樊
43
2025-09-09 06:23:31
栏目: 智能运维

在Ubuntu上自定义Filebeat配置文件可按以下步骤进行:

  1. 找到配置文件:Filebeat默认配置文件位于/etc/filebeat/filebeat.yml,用文本编辑器打开,如sudo nano /etc/filebeat/filebeat.yml
  2. 修改配置项
    • 输入源配置:在filebeat.inputs部分,可设置日志文件路径、类型等,如paths: ["/var/log/*.log"]
    • 输出配置:若输出到Elasticsearch,在output.elasticsearch部分设置主机、端口、索引等,如hosts: ["localhost:9200"],还可通过processors添加处理器来自定义输出格式,如添加自定义字段processors: - add_fields: fields: custom_field: "custom_value"
    • 其他配置:可根据需求设置日志级别、模块配置等,如logging.level: info
  3. 保存并重启:修改后保存文件,然后重启Filebeat服务使更改生效,sudo systemctl restart filebeat

0
看了该问题的人还看了