以下是一些CentOS與Filebeat集成的實戰技巧:
sudo yum install -y https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.14.0-x86_64.rpm
。/etc/filebeat/filebeat.yml
,指定要監控的日志文件路徑filebeat.inputs
,以及Elasticsearch的輸出地址output.elasticsearch
等。如filebeat.inputs: - type: log enabled: true paths: - /var/log/*.log
,output.elasticsearch: hosts: ["localhost:9200"]
。filebeat.autodiscover
自動發現數據源,適用于容器化環境。systemctl
命令啟動Filebeat并設置為開機自啟。/var/log/filebeat/filebeat.log
來監控Filebeat運行狀態和排查問題。