Closed syndbg closed 7 years ago
The issue is not related to changes in Sierra. Also Sierra on the latest version of OS X!
On Mac OS X v10.2 an later, Logstasher fails to initialize. When loading its configs, both generic and env specific, it looks for a :source
key.
config.source = yml_config[:source].present? ? yml_config[:source] : IPSocket.getaddress(Socket.gethostname)
IPSocket.getaddress
fails because Socket.gethostname
returns a .local
domain name (e.g. zeus.local). OSX uses such domains along with mDNS to resolve Bonjour services on the local network.
Since Ruby has no notion of this service, it tries to resolve the hostname using regular (unicast) DNS, which fails.
This is not specific to Ruby. The issue occurs on any other given language that uses POSIX libraries.
Thanks for the PR. Closing this issue 👍
The fix is now available in version 1.2.1
I fixed the issue by add the hostname in /etc/hosts.
Due to Apple's changes in MacOS Sierra and later, hostnames are unresolvable by the code in https://github.com/shadabahmed/logstasher/commit/dda48f5a3a040c3e1e808ab3c0293e1c147929d6.
That's paritaly due to MacOS adding
.local
to the hostname and even when using thehostname -s
to get the real hostname w/o.local
, the hostname is still not resolving to an IP.E.g