I'm trying to add a drilldown link to an Elastic search link in a Grafana chart. I'm able to use the variables that are already defined in my panel, but I also want to make use of the current time interval when creating the URL for elastic search.
I have tried using the following variables in the URL based on different online posts, hoping that they would be replaced by Grafana when the URL is clicked.
- $__interval
- $timeInterval
- $interval
but, nonw have been converted to the time range value that is currently selected.
e.g.: Url in Grafana:
https://elastic.local.dev/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:10000),time:(from:now-$__interval,mode:quick,to:now))&_a=(columns:!(_source),index:'logs-*',interval:auto,query:(language:lucene,query:'severity:FATAL%20AND%20%20environment:$environment'),sort:!('@timestamp',desc))
Expected Url when user clicks the chart:
https://elastic.local.dev/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:10000),time:(from:now-1h,mode:quick,to:now))&_a=(columns:!(_source),index:'logs-*',interval:auto,query:(language:lucene,query:'severity:FATAL%20AND%20%20environment:Development'),sort:!('@timestamp',desc))
Actual Url when user clicks the chart:
https://elastic.local.dev/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:10000),time:(from:now-$__interval,mode:quick,to:now))&_a=(columns:!(_source),index:'logs-*',interval:auto,query:(language:lucene,query:'severity:FATAL%20AND%20%20environment:Development'),sort:!('@timestamp',desc))
The $environment variable is being replaced as expected but the $__interval variable is not being replaced which causes the URL to not be parsed correctly by Elastic Search when trying to display the page.