I’m setting up a logstash container to receive and parse syslog messages shipped from a DHCP server. I can verify that these messages are being received on the docker host, but not in the logstash container running on that host. Docker is running in swarm mode with one manager and two workers. The logstash container was deployed as part of a stack. When running as a standalone container the syslog messages get to the container, but when I deploy it to the swarm the syslog messages are no longer reaching the container. The odd thing is that even though this isn’t working when deployed in the swarm, I can log into the DHCP server and using echo and nc I can successfully send messages to the logstash container running in the swarm.
To put it simpler, sending messages from remote host to logstash container doesn’t work when the container is deployed as a service in a swarm (while test messages sent from the same remote host to the same port are received) but everything works as expected when the same image is run as a standalone container.
I’m sure there’s something simple I’m missing here. Any advise is greatly appreciated.
Oh, judging by the details you provided so far there is nothing to realy work with… which led me to the understanding that your just want to share your experience with us.
Please share the service declaration in your compose.yml you use when deploying the container as a service and when deploying it as a plain container.
Is there a network declaration that your removed in your service? or are you using the implicitly created default network for the stack?
Your containers simply use different typo of network. with --net=host, the container shares the network namespace of the host, thus behaving like your host would do. While your swarm service container uses a published port on a bridged or overlay network.
We’ll I’ll be…that does it. You are awesome, thank you so much!
Question…I’m deploying back-end services along with this container that I need this container to be able to reach. Should I add a second network and add that to the other containers and add both networks to this logstash container?