Kibana 4 won't start with elasticsearch creds in the config


It seems that kibana can't communicate with ES 2.0 with the Shield plugin installed.

I see this message in kibana instead of the logstash interface:

`plugin:elasticsearch Authentication Exception

So I consulted these docs to find out that I had to include some authentication parameters in the kibana config:

Kibana Shield Docs

And I added the credentiails to the bottom of the kibana.yml

elasticsearch.username: 'kibana4-server'
elasticsearch.password: 'secret'

And after that, kibana won't restart! :confused:

I've also tried specifying the credentials both with soft quotes (") and without quotes, and I get the same result!

[root@logs:/opt/kibana] #ps -ef |grep kibana | grep -v grep
[root@logs:/opt/kibana] #

[root@logs:/opt/kibana] #service kibana status
kibana is not running

This is literally all I have in my kibana.yml config:

#egrep -v "^$|^#" config/kibana.yml "localhost"
elasticsearch.username: 'kibana4-server'
elasticsearch.password: 'secret'

I can see this error in the kibana logs:

FATAL CLI ERROR YAMLException: end of the stream or a document separator is expected at line 78, column 1:
 elasticsearch.username: "kibana4 ...

at generateError (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:160:10)
at throwError (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:166:9)
at readDocument (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1498:5)
at loadDocuments (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1538:5)
at load (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1555:19)
at Object.safeLoad (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1573:10)
at module.exports (/opt/kibana-4.2.1-linux-x64/src/cli/serve/readYamlConfig.js:43:19)
at Command.callee$1$0$ (/opt/kibana-4.2.1-linux-x64/src/cli/serve/serve.js:66:22)
at tryCatch (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at invoke (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at enqueueResult (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:185:17)
at new Promise (/opt/kibana-4.2.1-linux-x64/node_modules/babel-core/node_modules/core-js/modules/es6.promise.js:197:7)
at Promise.exports.(anonymous function).target.(anonymous function) function).F (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/node_modules/core-js/library/modules/$.export.js:30:36)
at AsyncIterator.enqueue (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:184:16)

I think at this point that the only thing standing in the way of my using LS with Shield is Kibana!

I have to remove the ES credentials from the kibana config so Kibana will start up again. But then I'm stuck with the error: plugin:elasticsearch Authentication Exception

How can I specify the elasticsearch credentials in the kibana config without causing it to barf?

Unbelievable! This was a yaml parsing issue. :rage:

Turns out I had a couple spaces leading the entry at the top of the file.

[root@logs:/opt/kibana] #egrep -v "^$|^#" config/kibana.yml "localhost"
elasticsearch.username: 'kibana4-server'
elasticsearch.password: 'secret'

Once I removed the spaces, kibana starts up fine. AND authenticates against shield!

[root@logs:/opt/kibana] #egrep -v "^$|^#" config/kibana.yml "localhost"
elasticsearch.username: 'kibana4-server'
elasticsearch.password: 'secret'

But why kibana starts with the space at the beginning of, before I add the elasticsearch parameters at the end, it beats me! Anyway, I seem to be on the right track at this point.

1 Like