Build/Create A URL for Kibana Dashboards/Graphs


(Vasan) #1

We are in the process of automating to display the Kibana logs in a Dashboards out of Kibana UI. We are thinking to use Python to pull the critical dashboards/graphs to show in our internal GUI. Is there any way to get the URLs for a Dashboards we are interested? Thanks in Advance. Any examples would be much helpfull.


(Brandon Kobel) #2

Hey @ktvasan, if you'd like to integrate Kibana Dashboards and Visualizations into your own application, I'd recommend using an iframe. When you're running Kibana if you click the "Share" button in the upper right corner, you'll get the following dialog which will give you the necessary iframe code to embed the Dashboard/Visualization in your application:


(Vasan) #3

Hi Brandon. Thanks for the reply.

We are using elastic-search api for Python to query the data and plot the graph in our own application.
For some reason, the Json data as a body was not posting along with my request URL. I get empty data object. Here is my code and the response.

#!/usr/bin/env python
import requests
from elasticsearch import Elasticsearch
import json

from ssl import create_default_context
cafile="my.perm.pac"

context = create_default_context()

url = "https://mydev-elk.dev1.com/elasticsearch/logstash-browse-access-logs-*/"

data=
{

"query": {
"bool": {
"must": [
{
"match_all": {}
},
{
"range": {
"log_timestamp": {
"gte": 1526916192084,
"lte": 1526917092084,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
},

"size": 0,
"_source": {
"excludes": []
},

"aggregations": {

"2": {
  "date_histogram": {
    "field": "log_timestamp",
    "interval": "5s",
    "time_zone": "America/Chicago",
    "min_doc_count": 1
  }
}

}

}

es = Elasticsearch(
[url],
http_auth=(user', 'pass'),
scheme="https",
port=443,
ssl_context=context,
)

res = es.search(index="/logstash-browse-access-logs-*", body=data)

print(res)

I get the following responses,

{'took': 507, 'timed_out': False, '_shards': {'total': 152, 'successful': 152, 'skipped': 0, 'failed': 0}, 'hits': {'total': 0, 'max_score': None, 'hits': []}}

But when I frame the URL and posted in the browser I got all my Json objects.

The below URL I was using Browser and got the response.

https://mydev-elk.dev1.com/elasticsearch/logstash-browse-access-logs-*/_search?source=
{
"query": {
"bool": {
"must": [
{
"match_all": {}
},
{
"range": {
"log_timestamp": {
"gte": 1526916192084,
"lte": 1526917092084,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
},

"size": 0,
"_source": {
"excludes": []
},

"aggregations": {

"2": {
  "date_histogram": {
    "field": "log_timestamp",
    "interval": "5s",
    "time_zone": "America/Chicago",
    "min_doc_count": 1
  }
}

}

}

Any idea what am I missing..


(Brandon Kobel) #4

Hey @ktvasan, nothing jumps out immediately as something you're doing wrong, but I'm not a python client expert.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.