Mike Hogan
Mike Hogan

Reputation: 10583

Link with context from Grafana to Kibana (retain time frame and lucene query)

I have Grafana setup with an Elasticsearch datasource and I am graphing 404 http status codes from my webserver.

I want to implement a drill down link to the Kibana associated with my Elasticsearch instance. The required URL is of this form:

https://my.elasticsearch.com/_plugin/kibana/#/discover?_g=(refreshInterval:(display:Off,section:0,value:0),time:(from:now-12h,mode:quick,to:now))&_a=(columns:!(_source),filters:!(),index:'cwl-*',interval:auto,query:(query_string:(analyze_wildcard:!t,query:'status:404')),sort:!('@timestamp',desc))

For the from: and to: fields, I want to use the current "from" and "to" values that Grafana is using. And for the query: field, I want to use the value from the "Lucene query" of the associated metric.

Does Grafana expose some context object from which I can pull these values, and thus generate the necessary URL?

Or is there some other way?

Upvotes: 4

Views: 1838

Answers (1)

Konstantin
Konstantin

Reputation: 184

It's now possible, starting Grafana 7.1.2:

complete working example:

https://kibana/app/kibana#/discover/my-search?_g=(time:(from:'${__from:date}',to:'${__to:date}'))&_a=(query:(language:lucene,query:'host:${host:lucene}'))

https://github.com/grafana/grafana/issues/25396

Upvotes: 1

Related Questions