How to display Json on a Kibana Dashboard?


#1

I have a field on my elasticsearch index which is a raw Json, like this for example:

{ "id": 1234, "title": "Nice Title" }

And I’m trying to display it in a nice user friendly way.

Since the information is coming from a field I can’t have it in a fixed markdown widget to display it, right? I’ve tried to create a url link sending the json to a markdown widget but that is only possible on the Visualize tab, not on a proper dashboard.

So my question is, is there a way to pretty print Json on a Kibana dashboard?


#2

Just to be clear, what I've tried was something like that:

http://localhost:5601/app/kibana#/visualize/create?type=markdown&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-1d%2Fd,mode:quick,to:now-1d%2Fd))&_a=(filters:!(),linked:!f,query:(query_string:(analyze_wildcard:!t,query:'*')),uiState:(),vis:(aggs:!(),listeners:(),params:(markdown:'%60%60%60json%0A%7B%20%0A%20%20%20%20%22id%22:%201234,%20%0A%20%20%20%20%22title%22:%20%22Nice%20Title%22%20%0A%7D%0A%60%60%60'),title:'New%20Visualization',type:markdown))

I could format my Json and input it on the link after "markdown:" using the field as a url string, but the result is not satisfactory.


(Jim Unger) #3

I can't access that link because it is in your local environment. Can you post a screenshot instead?


#4

It's just an example of how one could copy the link from the discovery page when creating a markdown widget and change the contents with an Url formatted string on kibana.


(Jim Unger) #5

Unfortunately, there isn't a way to have dynamic json in a visualization on a dashboard. What is the nature of the json that you want to display?

If the data doesn't change very often, and you have the means to generate the document, you could always pragmatically update a markdown visualization with updated json data. In the .kibana index, visualizations are stored as elasticsearch documents. You could query and inject the appropriate json object into the document. The dashboard would always have the most recent version of that visualization.

If the data is refreshed more frequently, or don't have a mechinism to generate the visualization document programatically, you could use Kibana's plugin system. You could create a new visualization plugin.

Unfortunately, the plugin stuff isn't really well documented yet. We have a yeoman generator to get you started though:

https://github.com/elastic/generator-kibana-plugin102

And this little example might help as well:

https://github.com/kreeware/kibana-cookbook/tree/master/asset-example151


#6

hmm... that's not exactly what I meant.
Let's say that I put on elasticsearch all the information coming from the system's logs, including headers/bodies from REST requests in Json format.
I would like to pretty-print said Json, so someone looking at that document on a Kibana view/dashboard is able to understand it at a glance, instead of looking at an unformatted one-line Json. Maybe we could have that as an option on the String format configs?


(Jim Unger) #7

Unfortunately, that functionality does not exist in Kibana right now. It sounds like it could be worth exploring. Submit a feature request, or if you're feeling industrious we accept PRs from the community. :slight_smile:


(system) #8