Kibana "server.host" parameter won't work with hostname


(Raul Kaubi) #1

Hi

Elastic,kibana 6.4.3
Centos 7.5

I am having problem with server.host parameter. It just won't work with hostname.

server.host: "someHostname.domain.com"
or
server.host: "someHostname"

Works with IP for example.

server.host: "192.168.1.5"

With hostname, I get this error when starting the service.

kibana[26938]: FATAL { ValidationError: child "server" fails because [child "host" fails because ["host" must be a valid hostname]]
kibana[26938]: at Object.exports.process (/usr/share/kibana/node_modules/joi/lib/errors.js:181:19)
kibana[26938]: at internals.Object._validateWithOptions (/usr/share/kibana/node_modules/joi/lib/any.js:651:31)
kibana[26938]: at module.exports.internals.Any.root.validate (/usr/share/kibana/node_modules/joi/lib/index.js:121:23)
kibana[26938]: at Config._commit (/usr/share/kibana/src/server/config/config.js:138:35)
kibana[26938]: at Config.set (/usr/share/kibana/src/server/config/config.js:108:10)
kibana[26938]: at Config.extendSchema (/usr/share/kibana/src/server/config/config.js:81:10)
kibana[26938]: at _lodash2.default.each.child (/usr/share/kibana/src/server/config/config.js:70:14)
kibana[26938]: at arrayEach (/usr/share/kibana/node_modules/lodash/index.js:1311:13)
kibana[26938]: at Function. (/usr/share/kibana/node_modules/lodash/index.js:3389:13)
kibana[26938]: at Config.extendSchema (/usr/share/kibana/src/server/config/config.js:69:31)
kibana[26938]: at new Config (/usr/share/kibana/src/server/config/config.js:60:10)
kibana[26938]: at Function.withDefaultSchema (/usr/share/kibana/src/server/config/config.js:53:12)
kibana[26938]: at
kibana[26938]: at process._tickCallback (internal/process/next_tick.js:188:7)
kibana[26938]: at Function.Module.runMain (module.js:695:11)
kibana[26938]: at startup (bootstrap_node.js:191:16)
kibana[26938]: at bootstrap_node.js:612:3
kibana[26938]: isJoi: true,
kibana[26938]: name: 'ValidationError',
kibana[26938]: details:
kibana[26938]: [ { message: '"host" must be a valid hostname',
kibana[26938]: path: 'server.host',
kibana[26938]: type: 'string.hostname',
kibana[26938]: context: [Object] } ],
kibana[26938]: _object:
kibana[26938]: { pkg:
kibana[26938]: { version: '6.4.3',
kibana[26938]: branch: '6.4',
kibana[26938]: buildNum: 18044,
kibana[26938]: buildSha: '968768f01f873fec244749abc3c6e939d0e3eda0' },
kibana[26938]: dev: { basePathProxyTarget: 5603 },
kibana[26938]: pid: { exclusive: false },
kibana[26938]: cpu: undefined,
kibana[26938]: cpuacct: undefined,
kibana[26938]: server:
kibana[26938]: { port: 5601,
kibana[26938]: host: 'someHostname.domain.com',
kibana[26938]: defaultRoute: '/app/monitoring' } },
kibana[26938]: annotate: [Function] }
systemd[1]: kibana.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Unit kibana.service entered failed state.
systemd[1]: kibana.service failed.
systemd[1]: kibana.service holdoff time over, scheduling restart.
systemd[1]: Started Kibana.
systemd[1]: Starting Kibana...

In linux, /etc/hostname has entry for full hostname (with domain), so for example:

someHostname.domain.com

Regards
Raul


(Raul Kaubi) #2

Anynone..?

Regards
Raul


(kulkarni) #3

Are you able to ping machine hostname directly ? That would be my first guess . Secondly, on the Kibana host, use netstat (assuming linux), e.g. netstat -an | grep 5601 , to see which host/port Kibana binds to. Check which interface Kibana is bound to on the Kibana host. If that is all interfaces, this still sounds to me like a networking/firewall issue. What about iptables on the host itself?

many things in play here...hope some of the above debugging helps...

Thanks
Rashmi


(Raul Kaubi) #4

Yes, ping works fine.
Hostname itself is 100% correct.

/usr/share/kibana/bin/kibana "-c /etc/kibana/kibana.yml"

FATAL Error: [server.host]: value is [correctHostname.domain.com] but it must be a valid hostname (see RFC 1123).

Changed to wrong hostname.

vi /etc/kibana/kibana.yml
/usr/share/kibana/bin/kibana "-c /etc/kibana/kibana.yml"

FATAL Error: getaddrinfo ENOTFOUND wrongHostname.domain.com

So if I change to wrong hostname, the error is totally different.

KIbana at the moment is bind to linux host IP address port 5601.

I don't understand..

Check which interface Kibana is bound to on the Kibana host.

Regards
Raul


(Josh Dover) #5

Hi there Raul,

I dug into the validation logic we use in 6.4.3 for the hostname and found that we do 2 checks:

  • The string must be <= 255 characters
  • The string must match this regex: /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/

Check to see if your hostname is matching these two criteria. I wasn't able to reproduce the problem with the exact examples you gave here, so I'm assuming you're actually using a different one than the ones given.

I went ahead and programmed that regex into this site here where you can try testing your hostname against it by pasting it into a new line in the "Test strings" section: https://www.regextester.com/?fam=105996


(Raul Kaubi) #6

Hi

Thanks for the update, same applies in 6.5.0 as well.

And I found the problem, my hostname looks something like this:

sometext_2.domain.com

"_" is something, that does not match. It was new to me that "_" is not allowed

Regards
Raul


(Josh Dover) #7

Yes, that underscore is probably the issue! You can use dashes instead. Glad we were able to track down the cause, though I'm sure this error could be a bit more informative.


(Raul Kaubi) #8

Couldn't agree you more ..:slight_smile:

But thanks a lot, problem solved.

Regards
Raul