debian

如何用Filebeat监控Debian服务器

小樊
88
2025-02-14 20:37:57
栏目: 云计算

要使用Filebeat监控Debian服务器,您需要按照以下步骤进行操作:

安装Filebeat

  1. 下载并安装Filebeat
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list
sudo apt-get update
sudo apt-get install -y filebeat
  1. 配置Filebeat
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/*.log

output.elasticsearch:
  hosts: ["localhost:9200"]
  1. 启动并启用Filebeat自启动
sudo systemctl start filebeat
sudo systemctl enable filebeat
  1. 验证配置
sudo filebeat -e -c /etc/filebeat/filebeat.yml -d

监控Filebeat本身

http.enabled: true
http.port: 5067

然后,您可以使用 curl 命令来获取Filebeat的状态信息:

curl -X GET "localhost:5067/stats?pretty"

注意事项

通过以上步骤,您可以在Debian服务器上成功部署和配置Filebeat,以监控服务器上的日志数据。

0
看了该问题的人还看了