Hi fellow Dockerteers,
Apologies if this has been asked before.
I’m trying to use the Gelf log driver to send data from a container to a linked Logstash instance living on the same server. However, when I do that the engine sends the following error that indicates the link is not known: “Failed to initialize logging driver: gelf: cannot connect to GELF endpoint: logstash:12201 dial udp: lookup logstash: no such host”
A simple test that demonstrates this is encapsulated in this docker-compose.yml:
apache:
image: httpd
ports:
- "80:80"
links:
- "logstash:logstash"
log_driver: "gelf"
log_opt:
gelf-address: "udp://logstash:12201"
logstash:
image: logstash
ports:
- "12201:12201"
- "12201:12201/udp"
volumes:
- ./conf:/conf
command: logstash -f /conf/gelf.conf
However, if I specify the server name in the gelf-address everything works fine, but this breaks the portability of the composition.
Is this a bug or gotcha or am I doing something wrong? (The smart money’s on the latter)
Thanks,
Matt