Skip to content

[8.19] [AI4DSOC] Change the logic to query the last alert ingested in an integration (#228602)#229767

Merged
PhilippeOberti merged 2 commits intoelastic:8.19from
PhilippeOberti:backport/8.19/pr-228602
Aug 1, 2025
Merged

[8.19] [AI4DSOC] Change the logic to query the last alert ingested in an integration (#228602)#229767
PhilippeOberti merged 2 commits intoelastic:8.19from
PhilippeOberti:backport/8.19/pr-228602

Conversation

@PhilippeOberti
Copy link
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

@elasticmachine
Copy link
Contributor

elasticmachine commented Jul 29, 2025

⏳ Build in-progress, with failures

Failed CI Steps

History

…egration (elastic#228602)

## Summary

This PR changes the logic used in the AI4DSOC alert summary page
integration section to display the last sync value for each integration
card displayed at the top of the page

In the previous logic we were fetching all dataStreams and use the
`last_activity_ms` value to display as the last sync for the
integration. We
[realized](elastic#220617) that some
dataStreams have event not related to ingested alert. For example it
could be event mentioning that an error is happening... This meant that
the alert summary UI was showing an incorrect last sync value.

The new logic leverage a call using ESQL that works as follow:
```
FROM logs-integrationName.alert-default
    | WHERE event.kind == "alert"
    | SORT event.ingested DESC
    | KEEP event.ingested
    | LIMIT 1
```
We fetch the information for each integration. We retrieve the last
document with `event.kind == 'alert'` then we sort to get the most
recent first, select only the `event.ingested` field/value pair and keep
only the first document.
The value from the `event.ingested` field is then passed to the
integration card and displayed for the last sync.

The PR also sets up a 30 second interval, to make sure that the values
in the integration card last sync section are updated periodically. This
will give the user an indication that the rest of the page below (charts
and table) might be out of date.

https://github.com/user-attachments/assets/b3524777-f994-40dd-90d1-0c757d1ec892

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

elastic#220617
(cherry picked from commit 5729233)

# Conflicts:
#	x-pack/solutions/security/plugins/security_solution/public/detections/hooks/alert_summary/use_integrations_last_activity.test.ts
@PhilippeOberti PhilippeOberti force-pushed the backport/8.19/pr-228602 branch from 1c5ddd7 to 3681375 Compare August 1, 2025 10:08
@PhilippeOberti PhilippeOberti merged commit 6644c93 into elastic:8.19 Aug 1, 2025
8 checks passed
@PhilippeOberti PhilippeOberti deleted the backport/8.19/pr-228602 branch August 1, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants