Running Kibana with Sense

December 18th, 2017 by Tony Messias

Lately we have been missing the Sense Chrome extension, basically because of the autocompletes when we are writing some Elasticsearch queries, or debugging something. It got blocked on Chrome due to a malware issue.

In that post, they mention Kibana has a console with the same functionality that we were missing from Sense extension, so I decided to give it a try.

Constraints

Before we jump in, let’s briefly discuss our setup for the project. We use:

  • Docker for local development
  • Elasticsearch 2.4

We haven’t had time to upgrade Elasticsearch yet, and I thought it was going to be a problem, but it wasn’t. Kibana has the console since version 4, and that version works fine with Elasticsearch 2.*.

Setting up

As I said, we use Docker locally. But the Sense Kibana plugin is not available in the official docker image in a pre-baked way, so I had to create our own custom image with it. Create a file under resources/docker/kibana/Dockerfile with the content:

FROM kibana:4

RUN gosu kibana kibana plugin --install elastic/sense/latest

EXPOSE 5601

ENTRYPOINT ["/docker-entrypoint.sh"]

CMD ["kibana"]

After that, I needed to change our docker-compose.yml file to add a new service:

version: '2'

services:
    # there were other services described here...

    kibana:
        image: projectname/kibana
        build:
            dockerfile: resources/docker/kibana/Dockerfile
            context: .
        ports:
            - 5601:5601
        links:
            - search:elasticsearch
        networks:
            - back

The key part here is that we are linking the existing Elasticsearch service, named as search, and we are aliasing it as elasticsearch inside the Kibana container.

Now we can run it:

docker-compose up -d

The new Kibana service is going to boot, and when we access the address http://localhost:5601, we can see the Kibana UI:

Kibana UI

Important part is this little icon here:

Kibana Plugins

It means we have plugins installed, and that is the Sense plugin we installed in our Dockerfile. Clicking there, drives us to the Sense page, which, as you can see, is similar to the previous Sense Chrome extension. You can use the alias we defined in our docker-compose.yml file as the Elasticsearch address.

Kibana Sense Plugin

Conclusion

That’s it! You now have Kibana running locally with the Sense plugin installed. We can use it to have some insights on our running cluster, or even for local development. Important to say that we are going to leave the Kibana service commented out in our docker-compose.yml, since not everyone needs to run it every time.

Have a nice holiday, a great 2018 to all of you, and see y’all in the next post.

Comments