溫馨提示×

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

小樊
45
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
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女