在Ubuntu上自定義Filebeat配置文件可按以下步驟進行:
/etc/filebeat/filebeat.yml,用文本編輯器打開,如sudo nano /etc/filebeat/filebeat.yml。filebeat.inputs部分,可設置日志文件路徑、類型等,如paths: ["/var/log/*.log"]。output.elasticsearch部分設置主機、端口、索引等,如hosts: ["localhost:9200"],還可通過processors添加處理器來自定義輸出格式,如添加自定義字段processors: - add_fields: fields: custom_field: "custom_value"。logging.level: info。sudo systemctl restart filebeat。