Link in Markdown panel to dashboard with specific time and refresh interval?

I'm using TSVB Markdown panels to present links to dashboards, like this:

[Dashboard title](#/dashboard/88da11e0-9c58-11eb-b38d-7b8e5ab9c930)

Such links are independent of the current space, which is how I like them. They link to the dashboard with that ID in whatever the current space happens to be. I do not want to cite a specific space in the URL. One reason: I copy the set of saved objects from my "dev" space to my "demo" space. When I view this Markdown in the dev space, I want to link to the dashboard in the dev space; in the demo space, I want to link to the dashboard in the demo space.

(How) can I present a link that goes to a dashboard and sets its time range and refresh interval? For example, as specified by the following query string:

?_g=(refreshInterval:(pause:!f,value:30000),time:(from:now-10m,to:now))

I've tried numerous URLs without success.

I don't particularly want to create a copy of this dashboard, and save it with time settings, simply to achieve this.

Closely related question: suppose I have a space, myspace, for which I have defined the following defaultRoute setting (to a "home" dashboard):

/app/dashboards#/view/d24954f0-a7e6-11eb-b38d-7b8e5ab9c930

To go to that home dashboard, I use the following URL:

http://elastichost.example.com:15601/s/myspace

(How) can I specify a query string in that URL that sets the time and refresh interval?

Simply appending a query string to that s/myspace URL does not work.

In practice, I need to cite the URL with the full dashboard ID:

http://elastichost.example.com:15601/s/myspace/app/dashboards#/view/d24954f0-a7e6-11eb-b38d-7b8e5ab9c930?_g=(refreshInterval:(pause:!f,value:30000),time:(from:now-10m,to:now))

That works, but I'm wistful about a URL without that long ID.

Great questions Graham. For the first question, it looks like you're using a fairly old URL format which may not be properly persisting state through the redirect. To fix this, you should replace markdown links in the format #dashboard/{id} with #view/{id}. I was able to get the time range state to apply on the destination dashboard with [Dashboard Title](#/view/edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b?_g=(refreshInterval:(pause:!f,value:30000),time:(from:now-10m,to:now)))

The second question is a bit more complex, and honestly sounds like more of a feature request. I can ask around though, to see if there is any way to get URL state from the default route.

Hi @devon.thomson ,

Thank you so much for your very helpful reply, and sincere apologies for this belated acknowledgment.

:+1:

Done. Works. And, yes, with that new URL path, the URL query string (for example, to set the time range) now works.

I forget where I first got that #dashboard/{id} URL from.

Can you point me to a topic in the Kibana docs that shows that #view/{id} URL format (ideally, but not necessarily, in the context of a Markdown panel)?

Since I was unknowingly using an old URL format for those links in Markdown, I thought it was worth asking: am I using the correct URL format in my defaultRoute setting:

/app/dashboards#/view/d24954f0-a7e6-11eb-b38d-7b8e5ab9c93a

Is /app/dashboards#/view/{id} correct in this context, or should I be using some other format?

After re-reading your reply—in particular, the phrase "get URL state from the default route"—I thought I should clarify what I meant, because I suspect I wasn't clear enough in my original post (sorry).

Given the following defaultRoute value for the KIbana space myspace:

/app/dashboards#/view/d24954f0-a7e6-11eb-b38d-7b8e5ab9c939

in my web browser, I'd like to specify the following URL (that is, with a query string for the time range and refresh interval):

http://myelastichost:5601/s/myspace?_g=(refreshInterval:(pause:!f,value:30000),time:(from:now-10m,to:now))

Kibana (7.11.2) ignores that query string; it replaces that query string with the query-string-format equivalents of the timepicker:timeDefaults and timepicker:refreshIntervalDefaults settings.

So, from my (admittedly, perhaps idiosyncratic) perspective, and with apologies if you think I'm splitting hairs, I don't want to "get URL state [e.g. time] from the default route", because I don't want to store that state in the defaultRoute setting. Rather, if a browser sends a request that matches the (query-string-less) defaultRoute URL, then I'd like Kibana to honor any query string specified with that request.

What do you think? Should I create a feature request issue in GitHub for this, or is this—the fact that Kibana ignores such query strings—a bug?

Here's my specific use case for wanting Kibana to honor query strings specified with the default route.

I'm about to publish a Docker image, based on the "all-in-one Elastic Stack" sebp/elk image, that includes sample data with dashboards. The container startup script imports the included Kibana saved objects and uses Logstash to ingest the included JSON Lines data. This works.

In the Docker image documentation, I want to provide a Kibana URL with a query string that specifies the absolute time range of the included sample data. So that user don't have to "hunt around" for that sample data: they can immediately start exploring the precise time range covered by that data.

I want that URL to consist of the default route with a query string.

I'd prefer not to:

  • Specify a URL that cites a view ID (long, inelegant)
  • Specify that time as the timepicker:timeDefaults setting value (while one use case for this Docker image is to view the sample data, another is to ingest the user's own data; in which case, the time range of the sample data would be an annoying and inappropriate default)

An option that I've used in the past in similar circumstances is to refer to the Kibana UI's own list of dashboards. For example:

http://myelastichost:5601/s/myspace/app/dashboards#/list?_g=(refreshInterval:(pause:!f,value:30000),time:(from:now-10m,to:now))

That works, in the sense that it avoids specifying a view ID in the URL, and when the user clicks a dashboard in the list, the time values in the query string are honored. But I want to do better: I want to point the user at the ("friendlier") "home" dashboard that I've developed as the intended entry point to this set of dashboards.

Perhaps I should just get over my squeamishness about specifying a view ID in the URL that I cite in the Docker image documentation. I can't just "hide" the URL-with-view-ID behind nicer-looking link text; I have to cite a URL. Because the hostname, port, and, potentially, space (I've made this user-definable via an environment variable) are not fixed: they depend on the user's specific environment. I typically tend to avoid presenting actual URLs in documentation, in favor of hyperlinks with link text. But in some cases, such as this one, it's unavoidable. Because I'm presenting a URL pattern with placeholders, rather than an actual URL.

Perhaps it's (past?) time I should start a new topic (or GitHub issue?) for this particular (sub-?)topic ("honoring query strings specified by requests that match the default route")?

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

Hi Graham! Sorry for the late reply, but yes it honestly sounds like a bug that Kibana doesn't honour the query string when entering a dashboard through the default route. If you haven't done so already, I would create an issue. This may not be related specifically to the dashboard plugin (my area of expertise), but ping me in the issue and I can assign it to the Kibana Presentation team, and we can do a little bit of research.

In the meantime, I'm afraid I don't have any suggestions for a workaround, other than using the listing page, or providing a URL pattern in your documentation.