我在单独的docker-compose.yml中运行logstash和filebeat。但filebeat无法连接到logstash。在等待logstash管道启动后,我可以正确地telnet到logstash telnet 127.0.0.1 5044
。
Filebeat无法创建连接。我收到这个错误。
ERROR pipeline/output.go:74 Failed to connect: dial tcp 127.0.0.1:5044: getsockopt: connection refused
这是我的文件架的docker-compose。
version: '2'
services:
filebeat:
image: docker.elastic.co/beats/filebeat:6.2.3
container_name: filebeat
user: root
volumes:
- flask-sync:/home/flask/app/web:ro
- ./filebeat/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
volumes:
flask-sync:
external: true
这是我的filebeat.yml
filebeat.prospectors:
- type: log
enabled: true
paths:
- /home/flask/app/web/tmp/log
output.logstash:
hosts: ["127.0.0.1:5044"]
这是我的docker-compose for logstash
version: '2'
services:
logstash:
image: docker.elastic.co/logstash/logstash:6.2.4
container_name: logstash
ports:
- "5044:5044"
volumes:
- ./logstash/logstash.conf:/usr/share/logstash/logstash.conf:ro
- ./logstash/config/:/usr/share/logstash/config/:ro
command: bin/logstash -f logstash.conf --config.reload.automatic
这是我的logstash.conf
input {
beats {
port => 5044
}
}
filter {
}
output {
stdout { codec => rubydebug }
}
答案 0 :(得分:0)
我有同样的问题: 检查在docker-compose.yml中导出5044端口
build:
context: logstash/
volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro
- /datos/sna/log:/datos/sna/log
ports:
- "5000:5000"
- "5044:5044"
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
depends_on:
- elasticsearch