Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multitenant setup with Kibana and Elasticsearch

I am going to use logstash+ES+kibana for my project. I want to know how to use this framework for multi tenants. Can any one explain me how after the authentication Kibana query the elastic search index and load in Kibana's dashboard? Can I restrict kibana to look for a specifix index of Elastic search for a particular user or some-id? Anybody has tried this?

Thnx

like image 709
nebi Avatar asked May 11 '13 18:05

nebi


People also ask

What is Elasticsearch multi-tenancy?

Elasticsearch is built on top of the Apache Lucene search library and provides a robust, scalable platform for running search and analytics applications. Multi-tenancy in Elasticsearch refers to the ability to support multiple tenants, or users, on a single instance of Elasticsearch.

How do you implement multi tenants?

We can implement multi-tenancy using any of the following approaches: Database per Tenant: Each Tenant has its own database and is isolated from other tenants. Shared Database, Shared Schema: All Tenants share a database and tables. Every table has a Column with the Tenant Identifier, that shows the owner of the row.

What are tenants in Elasticsearch?

A tenant is a named container for Saved Objects that provides access control based on Search Guard roles. The easiest way to think about tenants is the Elasticsearch index analogy: Instead of storing everything in one global Saved Objects index, each tenant uses its own dedicated index.


2 Answers

You could, but depending on your use case it is probably not a good idea. There are a few gotchas, particularly regarding security and separating the users. First Kibana is just javascript running in the browser. So whatever Kibana is allowed to do so is your user. You can however have a separate index pattern for each "user", but elastic search does not provide you any ways of authenticating a users or authorizing a user access to a specific index. You would have to use some sort of proxy for this.

I recommend http://www.found.no/foundation/elasticsearch-in-production/ and http://www.found.no/foundation/elasticsearch-security/ for a more in depth explanation.

like image 168
Omnidux Avatar answered Sep 30 '22 10:09

Omnidux


Create an index for each tenant.

In this way you can use a proxy (like the app the hosts kibana) to intercept the request and return a settings that includes the index to use.

The value that specifies the index to use can be the logged in user or you can get that value somewhere else.

To separate even more the data, you can use a prefix in each index name, and then when you specify an index you can use a pattern to take all the index related to only certain kind of data/entities.

Hope this help.

like image 31
Giovanni Bitliner Avatar answered Sep 30 '22 12:09

Giovanni Bitliner