Building Kibana Dashboard Dynamically


(Asad Rehman) #1

Hi All,
I have some indexes in elasticsearch and I have build my required dashboard with required visualizations in Kibana. My index contains data from different shops regarding their sales and revenues and visualizations are based upon that. But I had to build all the charts for all the data and indexes manually.

In future if more shops are added to the elasticsearch index, is there a way to write some code or something which can generate the graphs automatically in Kibana and I provide the logic in that code as we can do while programming in different languages.

Any help would be highly appreciated.


(Pieter Agenbag) #2

Look at the .kibana index in your elasticsearch ... it contains all the visualizations , dashboards etc. You can use the normal elasticsearch REST Api to modify and add to this index.

Alternatively , a lot of what drives a dashboard (the different panels and filters) can be changed directly in the url (in RISON format)


(Asad Rehman) #3

Thanks for your response Peter!
But won't that be manual too?
I am looking for a way to write a generic code which can generate graphs automatically for a written logic on Kibana dashboard.
Can you provide any elaborations or examples?


(Pieter Agenbag) #4

Sorry - I misunderstood. Thought you wanted to generate the dashboards programatically (in your code/script) instead of manually through the kibana interface.

Not quite sure I understand what you're trying to accomplish then ... unfortunately I'm pretty sure the answer is going to be "No, you cant"
But maybe explain with an example and them someone might have a workaround.


(Asad Rehman) #5

Thank you for your response Peter!
You are getting it right, I want to generate the graphs and dashboard programatically by some script or code, but what I want is that if new data comes, then new graphs can be built automatically e.g (just a rough example to explain my question well) :

for (i = 0 ; i < no. of shops in my index ; i++){
generate a graph for this shop on my dashboard;
}
Now this logic is independent of the no of shops or number of graphs, I add a new shop, I get a new graph on my dashboard, I want to achieve this.
Thank you.


(Pieter Agenbag) #6

In that case , my original answer stands.

You cant create a dashboard that automatically adds new graphs(visualizations) based on your data.

But , the dashboards are stored as json objects in the .kibana index , so you Can:

Do that , to generate the dashboard object with graphs for each store and then push it to the .kibana index , which will then update the existing dashboard and everyone who uses it will get the updated dashboard next time they refresh.

The visualizations are also stored there , so the same concept applies where you would first generate a visualization object (tying the data to the specific store) to push to .kibana , before you reference it in your dashboard.

Hope it makes sense and that it helps. As far as I know its the closes /only option you have to achieve something like you mention.
Have a look at the contents of the .kibana index - might make more sense when you see it.


(Rajeev) #7

Hi Pieter,

I am working in an application in which i need to create a dashboard for the index which is loaded into the elastic search.Actually I want to create dashboard programmatically based on the index name . Can you help me in that . I am using elastic search 2.1.1 ,log stash 2.1.1 and Kibana 4.3.1 and not able to find the .kibana so that i can have the json object of the dashboard.

Thanks


(Azzeddine Faik) #8

Hi Guys,

I am working in an php API to generate ELK dashboard.
the main idea is :

  • generate searches based on a specific query / metrics / and fields
  • generate visualizations from those searches using specific visState JSON Object
  • Create Dashboard from those visualizations.

Please, let me know if you tryed something like this, I don't want to reinvent the wheel. but I need such tools :
have a look at : https://github.com/azzeddinefaik/kibana-api


(Sarthak) #9

Hey can you tell me where is this .kibana index in elastic search, I mean the path. I am currently using ES 5.4.


(Siamak Layeghy) #10

This is how to do this: