HTTP_Poller Connection Refused from within a Docker contrainer

I'm really new to the ELK stack and honestly extremely shaky when it comes to understanding concepts like ports, port forwarding and how they relate to Docker and the ELK stack.

I'm currently trying to use HTTP Poller, as specified in this post: https://www.elastic.co/blog/introducing-logstash-http-poller

to query a website. Following the post, I opened up a port using ruby and sinatra on my local host, and I'm trying to test http poller on it.
The port is definitely open when I do telnet localhost 8000.

However, on the kibana dashboards all I see are connection refused errors.
like so: http_request_failure.error: Connection refused (Connection refused).

I suspect it has something to do with publishing ports in Docker(I'm using elk-docker).
I'd like to understand how http poller works with Logstash in the elk-docker container and if I need to specify a specific port or anything like that - it didn't seem to be an option when I read the docs.

1 Like

I get the same issue. Did you finally solve it ?

No, but I think I know why it doesn't work now. I believe the issue is that you'd have to configure the localhost:8000 to an address with 0.0.0.0. Connection Refused means that the port and address is up and running, but not accepting the connection from the Docker Container. Even if the docker is on your localhost, I believe it also has it's own IP address, so when localhost:8000 sees the incoming connection, it refuses it.

I started a flask application on 0.0.0.0:5000 but no luck :/, maybe I"m doing something wrong.
Regardless, if you use a different website, like google, or anything else, it'll be fine. I used httpstatu.us for testing purposes instead, and there are no errors.
My guess is that I just don't know how to properly configure my dummy server to accept all incoming connections.

I hope that helps!

What does your http_poller configuration look like? If it's attempting to connect to localhost:5000 that's probably the reason. Inside your Docker container I don't believe localhost maps to the host's localhost interface. Try connecting to the host's name or IP address.

1 Like

That was the issue, thank you!
I was attempting to connect to 'localhost:5000'

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.