1.查询镜像
docker search filebeat
2.拉取镜像
我此处选择的是prima/filebeat
docker pull prima/filebeat
3.创建配置文件
filebeat.prospectors:
- type: log
enabled: true
paths:
- /var/log/web/com-zy-logger/*.log
#----------------------------- Logstash output --------------------------------
output.logstash:
hosts: ["192.168.56.1:5044"]
logging.metrics.enabled: false
4.启动容器
docker run -d --name filebeat -v /opt/conf/filebeat.yml:/opt/conf/filebeat.yml -v /var/log/web/com-zy-logger/:/var/log/web/com-zy-logger prima/filebeat
5.开机启动
docker update --restart=always filebeat