# Monitoring Logstash running from docker container

**URL:** <https://discuss.elastic.co/t/monitoring-logstash-running-from-docker-container/120049>\
**Category:** Logstash\
**Created:** [February 15, 2018, 6:05pm UTC](https://discuss.elastic.co/t/monitoring-logstash-running-from-docker-container/120049 "2018-02-15T18:05:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![weili](https://avatars.discourse-cdn.com/v4/letter/w/9f8e36/32.png) [@weili](https://discuss.elastic.co/u/weili)\
**Post date:** [February 15, 2018, 6:05pm UTC](https://discuss.elastic.co/t/monitoring-logstash-running-from-docker-container/120049/1 "2018-02-15T18:05:00Z")

</div>

Logstash 5 supports node stats monitoring

[https://www.elastic.co/guide/en/logstash/5.0/node-stats-api.html](https://www.elastic.co/guide/en/logstash/5.0/node-stats-api.html)

However, I am having trouble making it work with logstash running from container.  
I use docker compose to start logstash container, and forward port 9600 to 9601 in the docker-compose file

logstash\_in:  
image: logstash:5  
command: sh -c "logstash -f /usr/local/logstash\_in/config"  
volumes:  
- ./input\_data:/etc/data  
- /opt/kf/logstash\_in/config:/usr/local/logstash\_in/config  
ports:  
- "5001:5000"  
- "8086:8080"  
- "9601:9600"  
links:  
- kf-shield-es-storage:elasticsearch  
- kf-shield-agent:namekocluster  
- kf-rabbitmq:messagebroker  
networks:  
- front  
depends\_on:  
- kf-shield-es-storage  
- kf-shield-agent  
logging:  
driver: "json-file"  
options:  
max-size: "2g"

I can see the port forwarding from "docker ps"

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  
bfd96e262022 logstash:5 "/docker-entrypoint.s" 9 seconds ago Up 2 seconds 0.0.0.0:5001-\>5000/tcp, 0.0.0.0:8086-\>8080/tcp, 0.0.0.0:9601-\>9600/tcp kf\_logstash\_in\_1

In the logstash config, I merely stated the input port 8080 for the application, so I don't think it has anything to do with monitoring, and I shouldn't need to add additional config for monitoring to work.

input {  
http {  
host =\> "0.0.0.0"  
port =\> "8080"  
id =\> "http\_api"  
}

When I curl the port 9601, I got "Connection reset by peer" error.

curl -XGET 127.0.0.1:9601/\_node/stats/jvm  
curl: (56) Recv failure: Connection reset by peer

The API works if I execute it within the container

docker exec -it $(docker ps -aqf "name=logstash\_in") curl 127.0.0.1:9600 | python -m json.tool  
{  
"build\_date": "2018-01-25T22:39:45+00:00",  
"build\_sha": "60c90edbb03bac3f472d11540dbebd575212ac44",  
"build\_snapshot": false,  
"host": "bfd96e262022",  
"http\_address": "127.0.0.1:9600",  
"id": "bd714795-bd6a-493a-b84c-9c2fef9e85b9",  
"name": "bfd96e262022",  
"version": "5.6.7"  
}

I don't think there is limitation on getting logstash stats with docker deployment, but I don't know which part I miss here.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 15, 2018, 6:05pm UTC](https://discuss.elastic.co/t/monitoring-logstash-running-from-docker-container/120049/2 "2018-03-15T18:05:01Z")

</div>

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