Fix issue Logstash fail to run on port 5000 on MacOS Monterey

0
1455
Fix issue Logstash fail to run on port 5000 on MacOS Monterey
Fix issue Logstash fail to run on port 5000 on MacOS Monterey

I will show you how to fix issue Logstash fail to run on port 5000 on MacOS Monterey on this post.

When you try to run Logstash, you might see an error some sort like this.

$ docker-compose up
Creating network "docker-elk_elk" with driver "bridge"
Creating volume "docker-elk_setup" with default driver
Creating volume "docker-elk_elasticsearch" with default driver
Creating docker-elk_elasticsearch_1 ... done
Creating docker-elk_setup_1         ... done
Creating docker-elk_logstash_1      ... error
Creating docker-elk_kibana_1        ...

Creating docker-elk_kibana_1        ... done

ERROR: for logstash  Cannot start service logstash: Ports are not available: listen tcp 0.0.0.0:5000: bind: address already in use
ERROR: Encountered errors while bringing up the project.

FYI: I was running ELK stack via docker compose, you can find it here: https://github.com/deviantony/docker-elk

The port is occupied by some service, let’s find out what service is using it.

$ lsof -i :5000
COMMAND   PID        USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ControlCe 504 petehouston   19u  IPv4 0x519816ddcc921f17      0t0  TCP *:commplex-main (LISTEN)
ControlCe 504 petehouston   20u  IPv6 0x519816cf65b7de9f      0t0  TCP *:commplex-main (LISTEN)

It says “ControlCe“, which is the Control Center service of MacOS.

The fix is very simple by opening the Sharing service and turning off the AirPlay Receiver, like below:

Fix issue Logstash fail to run on port 5000 on MacOS Monterey - blog.petehouston.com
Fix issue Logstash fail to run on port 5000 on MacOS Monterey

That’s it, now you can start running Logstash again without any problem.