Search code examples
kibanakibana-6

Automate exporting CSV report in Kibana


I am trying to automate the csv export in Kibana. I know we can always send POST request to generate the report but the file will be available in reporting tab and not downloaded automatically.

Is there any way by which an application can automatically download the file and save it locally i.e. without any manual intervention.

I am trying to make an application which will automatically download the report file weekly for a particular object.


Solution

  • Send the Post Request to generate CSV report. It will return a response as below:

    {
    "path": "/api/reporting/jobs/download/kiivr09200121bb65cdzn8p3",
    "job": {
        "id": "kiivr09200121bb65cdzn8p3",
      .............
     }
    

    We can easily download the file using the url in path variable. For e.g. if Kibana is running in localhost:5601 We can download it by the following url: http://localhost:5601/api/reporting/jobs/download/kiivr09200121bb65cdzn8p3.

    We need to set "kbn-xsrf" as true in headers, We also need to provide username and password in Basic Authorization incase Kibana needs authorization.