在CentOS上讓Filebeat與Elasticsearch配合使用,可按以下步驟操作:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.26-amd64.deb
,然后解壓并移動到合適位置,編輯/etc/elasticsearch/elasticsearch.yml
配置文件,設置集群名稱、節點名稱、網絡地址等參數,最后啟動服務sudo systemctl start elasticsearch
。wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.17.26-amd64.deb
,解壓后移動到/opt
目錄,創建符號鏈接sudo ln -s /opt/filebeat/bin/filebeat /usr/local/bin/filebeat
。/etc/filebeat/filebeat.yml
文件,設置輸入源,如監控/var/log/*.log
日志文件,配置輸出到Elasticsearch的主機和端口等信息。sudo systemctl start filebeat
啟動服務,若需開機自啟動,可執行sudo systemctl enable filebeat
。curl -X GET "localhost:9200/_cat/indices?v"
命令查看Elasticsearch中的索引,若有Filebeat相關索引,說明集成成功。