Filebeat docker container is not connecting to logstash docker container

Hi,

I've created custom docker images based on ubuntu for elasticsearch, kibana, logstash and filebeat and I'm trying to connect them to each other. I've started out with elasticsearch, which runs perfectly well and is accessable via browser on localhost and gives me the following output:

{
  "name" : "smoketestnode",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ehojjWChScK44ApYnsTYPQ",
  "version" : {
    "number" : "7.3.0",
    "build_flavor" : "oss",
    "build_type" : "deb",
    "build_hash" : "de777fa",
    "build_date" : "2019-07-24T18:30:11.767338Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

elasticsearch.yml:

network.host: 0.0.0.0
node.name: smoketestnode
cluster.initial_master_nodes: smoketestnode

The Kibana container also runs perfectly with the following configuration of kibana.yml:

server.name: kibana
server.host: "0"
elasticsearch.hosts: [ "http://elasticsearch:9200" ]

Via localhost:5601 the kibana UI is accessible and shows me indices of elasticsearch.

The logstash container seems to be running correctly as well with the following configuration:

pipelines.yml:

- pipeline.id: my-pipeline_1
  path.config: "/usr/share/logstash/config/logstash.conf"
  pipeline.workers: 3

logstash.conf:

input {
    beats {
		host => "0.0.0.0"
        port => 5044
    }
	stdin { }
}

output {
	stdout {
		codec => rubydebug
    }
}

and logstash.yml:

http.host: "0.0.0.0"
node.name: ls-node

calling localhost:9600 gives me the folowing information:

{"host":"01e71a615d31","version":"7.3.0","http_address":"0.0.0.0:9600","id":"6b3ebcda-7dce-4119-b1e0-9620d2872faf","name":"ls-node","ephemeral_id":"f581e5a4-24a5-4646-b031-3356f421942d","status":"green","snapshot":false,"pipeline":{"workers":2,"batch_size":125,"batch_delay":50},"build_date":"2019-07-24T19:58:34+00:00","build_sha":"e1b53df454f5d8047f5304977ff8984f5b51154d","build_snapshot":false}

Now starting the filebeat container with filebeat.yml:

filebeat.inputs:
- type: log
  paths:
    - /var/log/logstash-tutorial.log 
output.logstash:
  hosts: ["localhost:5044", "localhost:9600"]

... creates the following error:

ERROR pipeline/output.go:100 Failed to connect to failover(backoff(async(tcp://localhost:5044)),backoff(async(tcp://localhost:9600))): dial tcp [::1]:9600: connect: cannot assign requested address

Am i missing something ? I'm not sure how to solve this. Any help would be appreciated.

In filebeat you have to configure the port that has been configured in the Logstash beats input. Port 9600 is not meant for events being send to. Only port 5044.