Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to generate URLs in alert action parameters #49392

Closed
mikecote opened this issue Oct 25, 2019 · 16 comments · Fixed by #90525
Closed

Ability to generate URLs in alert action parameters #49392

mikecote opened this issue Oct 25, 2019 · 16 comments · Fixed by #90525
Labels
Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@mikecote
Copy link
Contributor

mikecote commented Oct 25, 2019

We'll need to eventually allow users to build URLs within emails, slack messages, etc that point to Kibana. In order to do this, we'll need some functions or pre-defined variables within the mustache templates to help building URLs back into the application.

Currently blocked by #45815.

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-stack-services (Team:Stack Services)

@pmuellr
Copy link
Member

pmuellr commented Nov 20, 2019

I think we would eventually want a link back to the original Kibana home page, or perhaps even a home page for a space, if that's all we could get if we end up getting #45815. Unfortunately, we'll need to do a little design work on where that would appear in the "context" passed to the action. We probably would want an entirely new object passed in, I'm thinking.

@mikecote
Copy link
Contributor Author

Adjusting the Mustache template values may be all we need. This is what we do currently: https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/alerting/server/lib/transform_action_params.ts#L29. We could either keep adding flat values to allow <a href="{{kibanaUrl}}/management/alerting/..." /> style URL building.

@mikecote mikecote moved this from Blocked to Backlog in Make it Action Nov 23, 2019
@mikecote mikecote moved this from Backlog to Mid Term in Make it Action Dec 6, 2019
@bmcconaghy bmcconaghy added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) and removed Team:Stack Services labels Dec 12, 2019
@peterschretlen
Copy link
Contributor

See also: #25247 which longer term may provide a solution

@bmcconaghy
Copy link
Contributor

Related to #25247

@pmuellr
Copy link
Member

pmuellr commented Apr 27, 2020

Per #64370, would be nice to generate links to the alert details page and the alert management page:

  • ${kbn-url}/app/kibana#/management/kibana/triggersActions/alert/${alert-id}
  • ${kbn-url}/app/kibana#/management/kibana/triggersActions/alerts

@mikecote
Copy link
Contributor Author

It looks like #25247 is now resolved, we should see if that suits our uses cases.

@mikecote mikecote moved this from Short Term to To-Do (Ordered by priority) in Make it Action May 11, 2020
@mikecote mikecote moved this from To-Do (Ordered by priority) to In Progress in Make it Action May 13, 2020
@mikecote mikecote self-assigned this May 13, 2020
@mikecote
Copy link
Contributor Author

The pluggable URL service will be available on the server side once #59453 is completed.

@mikecote mikecote removed their assignment May 26, 2020
@mikecote mikecote moved this from In Progress to To-Do (Ordered by priority) in Make it Action May 26, 2020
@mikecote
Copy link
Contributor Author

mikecote commented Jun 1, 2020

I had a chat with the App Architecture team last week. The work done for URL generators (#59453) is mostly for capturing / migrating app state and deep links. What we need is mostly the base URL of Kibana.

After chatting with @kobelb, the best approach seems to be the following:

  • Work with window.location by default to capture the URL on the browser side and make it work with alert action variables
  • Add an optional kibana.yml setting which can override the ones we get from the window.location via alert action variables

The R&D part here would be allowing the optional kibana.yml setting to overwrite the URL passed from the UI. Probably via mustache templates if a helper can do it or something..

EDIT: We may not require #45815 anymore.

@pmuellr
Copy link
Member

pmuellr commented Jul 22, 2020

Work with window.location by default to capture the URL on the browser side and make it work with alert action variables

I don't fully understand how this would work. Is the idea we would capture the URL when an alert is created to save the URL so we can inject it into action parameters? This obviously won't work for alerts created via curl invocations, eg. Where is saved? In the alert? Which is then problematic when servers migrate to new names.

I like the idea of somehow using window.location to help validate a kibana.yml config value, but not quite sure how that might work. We could maybe have the main alerts/connectors page test the value and present a warning if the config value didn't match what the browser is using - presumably without leaking the config setting (in case it's a security issue?). It would actually be nice for this config setting to be editable within Kibana itself, as we could provide the window.location value as the default value to use, and additionally warn if it doesn't match the config. Not sure where we'd store it tho.

Lastly, @matschaffer noted offline that cloud already passes the kibana URL around in various internal configs already - we'll certainly want to take advantage of that so that cloud deployments will be zero-config for this setting. We'll have to work with cloud folks to figure out the best way to pass this in.

@matschaffer
Copy link
Contributor

@pmuellr just for clarification, the internal configs I sent earlier are just for specific deployments.

But yes, ideally we should be able to link back to the kibana that generated any alert.

We should probably keep this configurable in the event of people using https://github.com/bitly/oauth2_proxy or a similar proxy for typical kibana access.

@matschaffer
Copy link
Contributor

Also window.location seems like it might preclude managing the alert via git (which we do exclusively), so that solution sounds less than ideal.

@mikecote mikecote moved this from Short Term to 7.x - Tentative in Make it Action Aug 6, 2020
@pmuellr
Copy link
Member

pmuellr commented Sep 16, 2020

I'm typically thinking about this as being able to provide a link to the alert details (eg, in a slack/email message), but even better for solution-based alerts (most of them!), it would be nice to have a link to a solution page relevant to the alert.

So it seems like we'll need to think about alerts providing an array of links, which could then (somehow) be rendered into relevant action parameters. We can provide a "free" link to the alert details, along with whatever the alert provides.

For index threshold, it would be nice to provide a link to a discover page that showed "relevant" documents, used the alerts window / interval for bucketing, etc.

@pmuellr
Copy link
Member

pmuellr commented Sep 16, 2020

Also note - it would probably be useful to provide these links within the alert details page as well. I suppose that could mean we may need to provide two URLs for a particular Kibana page - one that we use in email / slack / etc, and another that would be used to navigate to the same page, but staying within Kibana so no page reload would occur. I'm assuming those two "urls" could be different.

@mikecote
Copy link
Contributor Author

mikecote commented Feb 5, 2021

Moving from 7.x - Candidates to 7.13 after the latest 7.x planning session. If we get time, we will implement this.

@mikecote mikecote moved this from 7.x - Candidates to 7.13 in Kibana Alerting Feb 5, 2021
pmuellr added a commit to pmuellr/kibana that referenced this issue Feb 5, 2021
resolves elastic#49392

Adds the top-level mustache variable `kibanaBaseUrl` for action parameter
mustache templates.  The value comes from Kibana config, which, if not set
will result in this variable having the value `undefined`.
@pmuellr
Copy link
Member

pmuellr commented Feb 5, 2021

proof of concept in this PR

pmuellr added a commit to pmuellr/kibana that referenced this issue Feb 10, 2021
resolves elastic#49392

Adds the top-level mustache variable `kibanaBaseUrl` for action parameter
mustache templates.  The value comes from Kibana config, which, if not set
will result in this variable having the value `undefined`.
pmuellr added a commit to pmuellr/kibana that referenced this issue Feb 15, 2021
resolves elastic#49392

Adds the top-level mustache variable `kibanaBaseUrl` for action parameter
mustache templates.  The value comes from Kibana config, which, if not set
will result in this variable having the value `undefined`.
pmuellr added a commit to pmuellr/kibana that referenced this issue Feb 15, 2021
resolves elastic#49392

Adds the top-level mustache variable `kibanaBaseUrl` for action parameter
mustache templates.  The value comes from Kibana config, which, if not set
will result in this variable having the value `undefined`.
@pmuellr pmuellr moved this from 7.13 - Tentative to In Review in Kibana Alerting Feb 16, 2021
Kibana Alerting automation moved this from In Review to Done (Ordered by most recent) Feb 16, 2021
pmuellr added a commit that referenced this issue Feb 16, 2021
…exposed base URL (#90525)

resolves #49392

Adds the top-level mustache variable `kibanaBaseUrl` for action parameter
mustache templates.  The value comes from Kibana config, which, if not set
will result in this variable having the value `undefined` which will be rendered
as an empty string.
pmuellr added a commit to pmuellr/kibana that referenced this issue Feb 16, 2021
…exposed base URL (elastic#90525)

resolves elastic#49392

Adds the top-level mustache variable `kibanaBaseUrl` for action parameter
mustache templates.  The value comes from Kibana config, which, if not set
will result in this variable having the value `undefined` which will be rendered
as an empty string.
pmuellr added a commit that referenced this issue Feb 16, 2021
…exposed base URL (#90525) (#91563)

resolves #49392

Adds the top-level mustache variable `kibanaBaseUrl` for action parameter
mustache templates.  The value comes from Kibana config, which, if not set
will result in this variable having the value `undefined` which will be rendered
as an empty string.
@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
No open projects
Kibana Alerting
Done (Ordered by most recent)
Development

Successfully merging a pull request may close this issue.

7 participants