NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Middle2 views

Why won't Logstash, running as the logstash user on port 514, start, and how would you diagnose the issue?

Practice

Asked at

AI answer

On Linux, port 514 is usually considered a privileged port (ports below 1024), so the regular logstash user cannot bind to it without special permissions. I’ll check the exact error in the journal (journalctl -u logstash and the Logstash logs), then find out whether the port is in use and which transport is being used: sudo ss -lntup | grep ':514' and sudo ss -lnup | grep ':514'. In strace, you can look for the bind() call and its error code: for example, EACCES indicates insufficient permissions, while EADDRINUSE means the address or port is already in use. I’ll also check the input plugin configuration, SELinux/AppArmor, and the value of net.ipv4.ip_unprivileged_port_start.

Possible solutions: receive events on a port above 1024 and redirect traffic from 514; or configure the minimum required capabilities or systemd AmbientCapabilities=CAP_NET_BIND_SERVICE and CapabilityBoundingSet=CAP_NET_BIND_SERVICE. Don’t grant a capability to the entire Logstash Java process without careful consideration—first assess its scope and risks.