Search code examples
elasticsearchkibana

Reading logs from kibana through an API


So I'm looking for a way to read the kibana logs for my app through a REST API. Searching online didn't lead to what I wanted. I have an app called glass and the logs for it look like this:

enter image description here

I added a filter specifying application is glass and it yields these logs collected in the last 15 minutes.

Is there a REST API which I can use to get those logs from Postman for example?

I've also played with the Dev Console but I'm not sure I understand how to use it.

I've went through these docs: https://www.elastic.co/guide/en/kibana/master/api.html but couldn't find what I was looking for.


Solution

  • At the top-right of the Discover window, you have a button labeled "Inspect". Clicking on it will reveal the query that Kibana is sending to Elasticsearch.

    You can copy it and paste it into the Dev Tools console in order to play with it. You can also send it directly to Elasticsearch (the same way Kibana does it), using the Elasticsearch _search API. So you don't want to send your query through Kibana (which is just another ES client), but directly to your Elasticsearch server.