Landing on a dashboard with a dynamic time period


(RayC) #1

Hello guys,

I made a scripted field, say 'A', with setting an URL template to land on a dashboard. But I'd like set the time period on the landed dashboard based on a timestamp field in the original event having the field 'A'. Specifically, I'd like to set the time period nearby the specific timestamp (e.g., +/- 10 seconds).

Is there any possible way to do it using kibana or other functionalities?

I tried and searched for any clues to this with nothing. Hope I could get some help from here.

Cheers!
-ray


(Thomas Neirynck) #2

hi @mr_chang7,

the URL-formats are not documented, but you can use the time: property.

e.g.:

this url points to a dashboard with time between 2013-03-08T00:00:00.000Z' and '2018-03-07T21:54:43.686Z'. You can adjust the from to param as desired.

https://mykibana:9243/app/kibana#/dashboard/e8bdb540-ffc0-11e7-ac81-f372b1c72ba1?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:'2013-03-08T00:00:00.000Z',mode:absolute,to:'2018-03-07T21:54:43.686Z'))&_a=(description:'',filters:!(),fullScreenMode:!f,options:(darkTheme:!f,hidePanelTitles:!f,useMargins:!t),panels:!((gridData:(h:3,i:'1',w:6,x:0,y:0),id:ced24560-ffc0-11e7-ac81-f372b1c72ba1,panelIndex:'1',type:visualization,version:'6.1.1')),query:(language:lucene,query:''),timeRestore:!f,title:'1%20New%20Dashboard',viewMode:view)


(RayC) #3

Right, that's the sort of URL I'm dealing with. I'd like to adjust the from/to part based on my timestamp field. Wondering if this is only possible when I make a scripted field on the timestamp field as I have to provide the {{value}} to the URL? Can I do that on the field "A" while using the timestamp adjustment?

One side question: the URL opens a dashboard on a new tab. How can I open it on the same tab?

Thanks for your help.


(Thomas Neirynck) #4

you can access doc-values in your scripted field doing something doc['timestamp'].value.

This is a good intro: https://www.elastic.co/blog/using-painless-kibana-scripted-fields. It has some date examples.


(system) #5

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