Shami's Blog

Sysadmin, Because Even Developers Need Heroes

Logstash Hanging When Rebooting Ubuntu


Edit: 31/7/2022: I’m currently migrating all my logstash configurations to Vector , it has been much kinder to me than Logstash has ever been.

I maintain an ELK server running on Ubuntu 20.04 for testing. One issue I have faced is the Logstash service hanging on reboot. The server would not reboot and I end up having to power cycle.

It appears to be caused by the connection to Elasticsearch being severed when ElasticSearch is shut down before Logstash. One way to fix this is to make Elasticsearch a dependency of Logstash.

sudo systemctl edit logstash.service

This will make sure that Elasticsearch has to be started before starting Logstash, and more importantly will shut down Logstash before shutting down Elasticsearch. This has solved the issue for me.

About Me

Dev gone Ops gone DevOps. Any views expressed on this blog are mine alone and do not necessarily reflect the views of my employer.

twitter linkedin