在Ubuntu上进行Filebeat日志传输,可按以下步骤操作:
sudo apt-get update
和sudo apt-get install filebeat
安装。/etc/filebeat/filebeat.yml
。在filebeat.inputs
部分指定要采集的日志文件路径,如- type: log enabled: true paths: - /var/log/syslog
。在output
部分配置输出目标,若发送到Elasticsearch,可配置为output.elasticsearch: hosts: ["localhost:9200"]
;若发送到Logstash,则配置为output.logstash: hosts: ["localhost:5044"]
。sudo systemctl start filebeat
启动服务,sudo systemctl enable filebeat
设置开机自启。sudo systemctl status filebeat
查看运行状态,或查看/var/log/filebeat/filebeat
日志文件确保无错误。