Filebeat does not connect to elastcisearch

I have elasticsearch and kibana installed in a container. both working normally.

but filebeat communication has not been working. When I run ./filebeat.exe test output in powershell I receive the following message:

PS C:\Program Files\Filebeat> .\filebeat.exe test output
elasticsearch: https://127.0.0.1:9200...
  parse url... OK
  connection...
    parse host... OK
    dns lookup... OK
    addresses: 127.0.0.1
    dial up... ERROR dial tcp 127.0.0.1:9200: connectex: No connections could be made because the target machine actively refused them.

As a test I installed elasticsearch and kibana via apt. The same message appeared. However, I changed kibana's yml by enabling portal 5601 and defining the ip. With this, filebeat communicated normally.

I then did the same in kibana's yml inside the container and it didn't work.

Does anyone know how to resolve this issue?

Hi @Misa, if you're using a container (I guess docker on windows), you may have to open specific ports between the machines. Filebeat works with the tcp 9200 (for elastic) by default.

If the log says your elastic refuses the connexion, it can be caused by a blocked port or a misconfiguration in filebeat or elastic (on the port you have to use for the connexion).

And because you use https, be sure to have a valid key and certificate for elastic.

After doing so, everything is working for me, you may want to share some configuration to see where the issue can come from.