实现Ubuntu Filebeat远程管理可从配置、安全、监控等方面入手,具体如下:
远程日志采集配置
/etc/filebeat/filebeat.yml
,通过filebeat.inputs
指定远程日志路径,例如:filebeat.inputs:
- type: log
enabled: true
paths: ["/var/log/remote/*.log"]
fields: {host: "remote-server-ip"} # 标记远程主机
output.elasticsearch:
hosts: ["主服务器IP:9200"]
集中配置管理
/etc/filebeat/config
),将Filebeat配置文件放置其中,远程服务器通过挂载共享目录实现配置同步。安全访问控制
filebeat.yml
中配置SSL证书,确保日志传输安全。ufw
)限制Filebeat服务端口(默认9200)的访问IP。filebeatuser
),避免以root身份运行。远程监控与维护
systemctl status filebeat
确保服务正常运行。关键参考: