DNS lookup failure: host in /etchosts

I provisioned the destination hostname in /etc/hosts for testing, but looks like filebeat doesn't honor /etc/hosts entries... Just asking first before putting a bug. Seems like it's not using the normal Linux resolvers.

016-05-03T20:57:32Z WARN DNS lookup failure "test.example.net": lookup test.example.net on x.x.x.x:53: no such host

[root]# cat /etc/hosts localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 test.example.net

I have used /etc/hosts for defining hostnames resolved by Beats.

You can enable debug for Go's DNS resolution so you can see what decisions it's making.

export GODEBUG=netdns=2
./filebeat -c myconfig -e -v
go package net: dynamic selection of DNS resolver
go package net: hostLookupOrder(test123.example.com) = files,dns

The name resolution behavior of Go is described here.

1 Like

I can't reproduce anymore. This works just fine.