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

[Alerting] "View in App" for ES Query Alert Type #89480

Open
ymao1 opened this issue Jan 27, 2021 · 8 comments
Open

[Alerting] "View in App" for ES Query Alert Type #89480

ymao1 opened this issue Jan 27, 2021 · 8 comments
Labels
enhancement New value added to drive a business result estimate:small Small Estimated Level of Effort Feature:Alerting/RuleTypes Issues related to specific Alerting Rules Types response-ops-ec-backlog ResponseOps E&C backlog Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@ymao1
Copy link
Contributor

ymao1 commented Jan 27, 2021

For the ES query alert type #88528, we would like to explore a way of allowing users to access the raw documents that matched their query and threshold conditions, possible through a "View in App" view. The top 1000 hits are currently passed through the action context for use inside actions, so this is one way they can currently see the documents but (1) it is not ideal to be storing that much data even temporarily inside of a saved object and (2) if the query happened to match hundreds of thousands (millions!?!?!) of documents, the user would not be able to get them.

@ymao1 ymao1 added Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Jan 27, 2021
@elasticmachine
Copy link
Contributor

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

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 27, 2021

Currently, during each execution of this alert type, when the threshold conditions are matched, the following is stored inside the alert instance state: dateStart, dateEnd, latestTimestamp. These, along with the query from the alert params, should be all we need to recreate the query that led to that active alert instance.

If we stored the alert instance state inside the event log when event.action: active-instance, we could base the View in App off of the event log by retrieving all active-instance events for that alert id. This would allow us to show a history of every time the alert was active, and for each entry, recreate the query and retrieve the documents.

Example of event log entry with alert instance state
{
	"_index": ".kibana-event-log-8.0.0-000001",
	"_id": "snhvRXcBW6kYwWa7bbzd",
	"_score": null,
	"_source": {
		"@timestamp": "2021-01-27T20:01:06.371Z",
		"event": {
			"provider": "alerting",
			"action": "active-instance"
		},
		"kibana": {
			"alerting": {
				"instance_id": "query matched",
				"action_group_id": "query matched",
				"alert_instance_state": """{"latestTimestamp ":1611777610424,"dateStart ":"2021 - 01 - 27 T19: 56: 06.365 Z ","dateEnd ":"2021 - 01 - 27 T20: 01: 06.365 Z "}"""
			},
			"saved_objects": [{
				"rel": "primary",
				"type": "alert",
				"id": "f13c3580-60c9-11eb-bc88-8173d2f513c6"
			}],
			"server_uuid": "5b2de169-2785-441b-ae8c-186a1936b17d"
		},
		"message": ".es-query:f13c3580-60c9-11eb-bc88-8173d2f513c6: 'test' active instance: 'query matched' in actionGroup: 'query matched'",
		"ecs": {
			"version": "1.6.0"
		}
	},
	"sort": [
		1611777666371
	]
}

@pmuellr
Copy link
Member

pmuellr commented Jan 29, 2021

If we stored the alert instance state inside the event log when event.action: active-instance ...

That's a big (as in bytes) ask! :-) Not because this specific data is too large, but because we don't know how big instance state is for other alerts. But in general, this feel like it should be part of the "alerts as data" work coming - not clear WHAT kind of data we'll be storing for alerts, or WHERE, but presumably once we have a mechanism, this alert could make use of it to store that state.

we could base the View in App off of the event log by retrieving all active-instance events for that alert id.

So the idea would be to get all the active-instance events, get the time ranges from those, build a filter that filters only within those dates, run the original query with that filter, that shows all the hits. I assume we'll need a new view for that - I think that was discussed in a recent call.

I'd love to have a super-easy version of this that just opened Discover with your query, forget about the time ranges. There would be noise - all the docs that didn't make the threshold limit would show. But perhaps that would be useful none-the-less - you might find that you wanted to decrease your threshold, for instance, if you saw situations where you did want to be notified, but the threshold didn't set the alarm off. Bigger problem is that we can't just throw this into Discover, AFAIK, since Discover works off of KQL | Lucene, not query DSL.

I guess that's a good question - why isn't there something like Discover in Kibana, that works off of query DSL? Or is there and I'm not aware of it? Or maybe we could morph Discover such that we can feed it query DSL for it to make the calls with, but not allow the "original query" (in query DSL) to be modified (maybe show it as read-only text?). You'd still want all the other control-ly bits to work - time ranges, additional filters, etc.

@pmuellr
Copy link
Member

pmuellr commented Feb 2, 2021

Just happened to think that we could likely construct the query we're going to run, and provide a way to paste that into the dev console, for the user to run. Should/could be paired with #84417

@gmmorris gmmorris added the Feature:Alerting/RuleTypes Issues related to specific Alerting Rules Types label Jul 1, 2021
@gmmorris gmmorris added the loe:medium Medium Level of Effort label Jul 14, 2021
@gmmorris gmmorris added enhancement New value added to drive a business result estimate:small Small Estimated Level of Effort and removed Feature:Alerting labels Aug 13, 2021
@gmmorris gmmorris removed the loe:medium Medium Level of Effort label Sep 2, 2021
@ymao1
Copy link
Contributor Author

ymao1 commented Dec 3, 2021

@arisonl What do you think of closing this since there have been no requests for it since the ES Query type was introduced?

@arisonl
Copy link
Contributor

arisonl commented Dec 6, 2021

hey @ymao1, for awareness there is a number of user requests around being able to access the query payload. Now, first they are not all necessarily around the ES query type, but I think that starting with the ES query type might go a long way. Second, we have a number of requests around being able to manipulate the payload in order to populate action parameters. Could the "view in app" be a first step towards that?

@ymao1
Copy link
Contributor Author

ymao1 commented Dec 6, 2021

@arisonl Gotcha thank you! We can keep this issue open for ES Query View in App if there are requests for it. I believe we have a separate issue for tracking payload manipulation in action variables - #89161

@arisonl
Copy link
Contributor

arisonl commented Dec 7, 2021

@ymao1 when the time comes, I think that we should think about these issues as an end-to-end use case with the UX that we want to produce around it, rather than separate, independent increments.

@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
@mikecote mikecote moved this from Blocked / On hold to Blocked in AppEx: ResponseOps - Execution & Connectors Dec 18, 2023
@mikecote mikecote added the response-ops-ec-backlog ResponseOps E&C backlog label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result estimate:small Small Estimated Level of Effort Feature:Alerting/RuleTypes Issues related to specific Alerting Rules Types response-ops-ec-backlog ResponseOps E&C backlog Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
No open projects
Development

No branches or pull requests

7 participants