Filebeat与Elasticsearch协同工作在CentOS上的步骤如下:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-linux-x86_64.tar.gz
tar -xzf elasticsearch-7.10.2-linux-x86_64.tar.gz
cd elasticsearch-7.10.2
./bin/elasticsearch
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.10.0-amd64.deb
sudo dpkg -i filebeat-7.10.0-amd64.deb
/etc/filebeat/filebeat.yml
。filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ["localhost:9200"]
index: "filebeat-%{[agent.version]}-%{+yyyy.MM.dd}"
filebeat.inputs
定义了Filebeat要监控的日志文件路径。output.elasticsearch
定义了Elasticsearch的主机和索引名称。sudo systemctl start filebeat
sudo systemctl enable filebeat
sudo systemctl status filebeat
http://your_elasticsearch_host:5601
),然后检查是否有新的索引被创建。curl -X GET "localhost:9200/_cat/indices?v"
你应该能看到一个名为 filebeat-*
的索引,其中包含了Filebeat发送的日志数据。
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.10.2-linux-x86_64.tar.gz
tar -xzf kibana-7.10.2-linux-x86_64.tar.gz
mv kibana-7.10.2 /opt/kibana
/opt/kibana/config/kibana.yml
文件,确保以下配置:server.host: "0.0.0.0"
elasticsearch.hosts: ["http://localhost:9200"]
sudo systemctl start kibana
sudo systemctl enable kibana
现在,你应该能够在Kibana中看到通过Filebeat发送的日志数据。
通过以上步骤,你已经成功地在CentOS上将Filebeat与Elasticsearch集成,并且可以通过Kibana来可视化和分析日志数据。如果有任何问题,请参考Elastic官方文档或社区支持。