Exporting a Timelion PNG at a certain date

Hello everyone,

I'm a beginner of Elastic/Kibana and I'm really struggling to find a topic talking about what I want on Google so here I am and I hope you can help me.

So, I have a Timelion visualization and I want to export it as a PNG to put it in a Word document via a PHP script. The problem is, I want to be able to put a time range in the PHP code and add it to the Dashboard POST URL and then curl it into an image. The time range would be generated from my website.

Is it possible this way or another ? I can't find something close to it on the forums etc.. Maybe with an API ?

Thank you for your help !

The POST url you can copy from the dialog on Dashboard or Visualize is the API to fetch a report - the time range is part of that. A small example:

This is my visualization - notice the "Last 24 hours" in the time picker.

Now I'm copying the POST url:

This gives me:
http://my_kibana_host/api/reporting/generate/png?jobParams=%28browserTimezone%3AEurope%2FBerlin%2Clayout%3A%28dimensions%3A%28height%3A381%2Cwidth%3A907%29%2Cid%3Apng%29%2CobjectType%3Avisualization%2CrelativeUrl%3A%27%2Fapp%2Fvisualize%23%2Fedit%2Fde899760-1a7f-11eb-9616-df3bbcea55eb%3Ftype%3Dtimelion%26_g%3D%28filters%3A%21%21%28%29%2Cquery%3A%28language%3Akuery%2Cquery%3A%21%27%21%27%29%2CrefreshInterval%3A%28pause%3A%21%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-24h%2Cto%3Anow%29%29%26_a%3D%28filters%3A%21%21%28%29%2Clinked%3A%21%21f%2Cquery%3A%28language%3Alucene%2Cquery%3A%21%27%21%27%29%2CuiState%3A%28%29%2Cvis%3A%28aggs%3A%21%21%28%29%2Cparams%3A%28expression%3A%21%27.es%28%2A%29%21%27%2Cinterval%3Aauto%29%2Ctitle%3Atest%2Ctype%3Atimelion%29%29%27%2Ctitle%3Atest%29

it looks really messy, but around halfway through there's this part:
time%3A%28from%3Anow-24h%2Cto%3Anow%29%29

This is the value of the current time picker - it's the html encoded version of time:(from:now-24h,to:now) which in turn is the rison encoded version of this JSON snippet: "time": { "from": "now-24h", "to":"now"}. You can generate this URL inside your PHP script and switch out now-24h and now with your desired time range programatically. It also takes absolute dates as an ISO string, play around with the Kibana UI and generate the URL to see how it behaves.

Hi Joe,

That is exactly what I wanted, thank you for clarification, really appreciated !

Have a good day,
Docrom

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