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

Data formatting and manipulation support for Alert payloads #77793

Closed
alexfrancoeur opened this issue Sep 17, 2020 · 6 comments
Closed

Data formatting and manipulation support for Alert payloads #77793

alexfrancoeur opened this issue Sep 17, 2020 · 6 comments
Labels
discuss enhancement New value added to drive a business result estimate:needs-research Estimated as too large and requires research to break down into workable issues Feature:Alerting/RuleActions Issues related to the Actions attached to Rules on the Alerting Framework Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@alexfrancoeur
Copy link

We've received a request where it would be useful to use painless to transform the data returned before sending off to a 3rd party integration. This could be PagerDuty, ServiceNow, etc. This makes it much easier for the consumer of the incident to understand the data coming through.

Painless is a language that is already in use with Watcher, so there is an argument and preference for this syntax over others. Having to learn another language adds additional overhead. The alternative, and one I believe we've been leaning towards in the past, is to use Kibana expressions and functions to provide this level of transformation and flexibility.

This issue is meant to track the enhancement request and will need to be discussed and prioritized accordingly. This request has some similarities to #76910.

@alexfrancoeur alexfrancoeur added Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Sep 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@mikecote
Copy link
Contributor

Creating alerts with Kibana expressions is still fairly out (#50270). I wonder if there's anything with expressions that could solve this requirement.

@pmuellr
Copy link
Member

pmuellr commented Sep 21, 2020

Curious about thoughts on executing arbitrary painless code from Kibana. Below is what the painless lab is doing - is this the recommended approach? That part seems pretty straight-forward, if so.

try {
const callAsCurrentUser = ctx.core.elasticsearch.legacy.client.callAsCurrentUser;
const response = await callAsCurrentUser('scriptsPainlessExecute', {
body,
});

The hard part would be figuring out how this all fits together. Do we allow action parameters to be "scripted" as well as supporting the built-in mustache templating? How would this work in the UI? How do the shape of the action parameters change to accommodate this?

I think we should start with some specific scenarios from customers here, if they're already chiming in. What kind of things are they expecting to be able to do?

@gmmorris gmmorris added the Feature:Alerting/RuleActions Issues related to the Actions attached to Rules on the Alerting Framework label Jul 1, 2021
@gmmorris gmmorris added the loe:needs-research This issue requires some research before it can be worked on or estimated label Jul 14, 2021
@gmmorris
Copy link
Contributor

@arisonl @alexfrancoeur I think this issue is a near-duplicate of #89161 but not a 1-to-1 overlap.

Should they be merged into one? Should we dedup the parts that are the same?

cc @mikecote

@gmmorris gmmorris added enhancement New value added to drive a business result estimate:needs-research Estimated as too large and requires research to break down into workable issues labels Aug 16, 2021
@gmmorris gmmorris removed the loe:needs-research This issue requires some research before it can be worked on or estimated label Sep 2, 2021
@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
@pmuellr
Copy link
Member

pmuellr commented Oct 12, 2023

Since this was opened, we've extended mustache to support some data manipulation like date, number formatting, in the following PRs:

Presumably additional manipulations can be added in the same fashion.

Since no other specific manipulations were mentioned here, I'm going to close.

As a further note, we have done some experiments trying to use expressions somehow, but the problem is that our current path through mustache templating is synchronous, and using expressions would require async. As would painless support. Painless would be a bit painful given the extra network hop and potentially huge payloads of the alert context to process.

@pmuellr
Copy link
Member

pmuellr commented Oct 12, 2023

Also note that with ES|QL support, it should be possible to do some amount of "manipulation" within the queries sent to ES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss enhancement New value added to drive a business result estimate:needs-research Estimated as too large and requires research to break down into workable issues Feature:Alerting/RuleActions Issues related to the Actions attached to Rules on the Alerting Framework Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
No open projects
Development

No branches or pull requests

6 participants