-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Added mapping for actor and target entity id, related.entity #224483
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
Conversation
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security) |
src/platform/packages/shared/kbn-alerts-as-data-utils/src/field_maps/alert_field_map.ts
Outdated
Show resolved
Hide resolved
...gration/spaces_only/tests/alerting/group4/alerts_as_data/alerts_as_data_dynamic_templates.ts
Outdated
Show resolved
Hide resolved
…s/alerting/group4/alerts_as_data/alerts_as_data_dynamic_templates.ts
* 2.0. | ||
*/ | ||
|
||
import { alertsFieldMap8190 } from '../8.19.0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that correct to import from 8.19? or should I've imported from earlier release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine, given that the new mappings are always based on those of the previous release.
src/platform/packages/shared/kbn-alerts-as-data-utils/src/field_maps/alert_field_map.ts
Outdated
Show resolved
Hide resolved
f0269b4
to
ffc9f2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response ops changes lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I have ran the PR locally and tested that indeed I am able to filter by the added fields following the instructions provided.
💚 Build Succeeded
Metrics [docs]
History
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
## Summary Closes #221037 , shows alerts on the graph by querying both the logs and the alerts indices - [x] Graph API - new optional `indexPatterns` parameters to switch data views (not in use in the UI atm). Defaults to `.alerts-security.alerts-<spaceId>, logs-*` - [x] Visualize loaded alerts that are identified with alerts in graph preview and graph investigation ~Depends on #224483 `actor` and `target` are not part of ECS yet. And to ease our development process we wish to push forward with this feature in mind. This feature supports both cases when alert's index mappings contains definition for `actor` and `target`, and also when its not. In this PR, we add mappings of `actor` and `target` to the es_archive of the alerts. This way we are able to test the functionality of this feature instead of being blocked by #224483. <details> <summary>Video 🎥 </summary> https://github.com/user-attachments/assets/bcc86214-6e88-46f3-a990-300bbdc28125 </details> <details> <summary>Screenshots 📸 </summary> **Before (ignore label alignments - screenshot is from a local environment)**  **After (another event is identified with alert - marking it as such and expands the _alert_ details)**  **Before network page - preview**  **After network page - preview identifies if event contains alert**  </details> ### How to test locally 1. Edit `kibana.dev.yml` and add: ```yml uiSettings.overrides.securitySolution:enableGraphVisualization: true ``` 2. Start elasticsearch and kibana locally 3. To add mock data run the following: ```bash node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/security_alerts_modified_mappings \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 ``` 3. Open `Alerts` page in kibana. Update the date-picker to include data from a year ago. Then check one of the alerts details opening the right-side flyout and find the "Graph preview" section in it. 4. Expand graph to show related alerts 5. Enable Asset Inventory in the `Inventory` page (if you don't see the page enable the feature flag in the advanced settings) 6. Add entities mock data ``` node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_api/es_archives/entity_store \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 ``` 7. Open `Alerts` page in kibana. Check that the graph shows the admin entity with it's label ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
An agreement on the fields yet to come, closing the PR for now |
…c#224783) ## Summary Closes elastic#221037 , shows alerts on the graph by querying both the logs and the alerts indices - [x] Graph API - new optional `indexPatterns` parameters to switch data views (not in use in the UI atm). Defaults to `.alerts-security.alerts-<spaceId>, logs-*` - [x] Visualize loaded alerts that are identified with alerts in graph preview and graph investigation ~Depends on elastic#224483 `actor` and `target` are not part of ECS yet. And to ease our development process we wish to push forward with this feature in mind. This feature supports both cases when alert's index mappings contains definition for `actor` and `target`, and also when its not. In this PR, we add mappings of `actor` and `target` to the es_archive of the alerts. This way we are able to test the functionality of this feature instead of being blocked by elastic#224483. <details> <summary>Video 🎥 </summary> https://github.com/user-attachments/assets/bcc86214-6e88-46f3-a990-300bbdc28125 </details> <details> <summary>Screenshots 📸 </summary> **Before (ignore label alignments - screenshot is from a local environment)**  **After (another event is identified with alert - marking it as such and expands the _alert_ details)**  **Before network page - preview**  **After network page - preview identifies if event contains alert**  </details> ### How to test locally 1. Edit `kibana.dev.yml` and add: ```yml uiSettings.overrides.securitySolution:enableGraphVisualization: true ``` 2. Start elasticsearch and kibana locally 3. To add mock data run the following: ```bash node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/security_alerts_modified_mappings \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 ``` 3. Open `Alerts` page in kibana. Update the date-picker to include data from a year ago. Then check one of the alerts details opening the right-side flyout and find the "Graph preview" section in it. 4. Expand graph to show related alerts 5. Enable Asset Inventory in the `Inventory` page (if you don't see the page enable the feature flag in the advanced settings) 6. Add entities mock data ``` node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_api/es_archives/entity_store \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 ``` 7. Open `Alerts` page in kibana. Check that the graph shows the admin entity with it's label ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
…c#224783) ## Summary Closes elastic#221037 , shows alerts on the graph by querying both the logs and the alerts indices - [x] Graph API - new optional `indexPatterns` parameters to switch data views (not in use in the UI atm). Defaults to `.alerts-security.alerts-<spaceId>, logs-*` - [x] Visualize loaded alerts that are identified with alerts in graph preview and graph investigation ~Depends on elastic#224483 `actor` and `target` are not part of ECS yet. And to ease our development process we wish to push forward with this feature in mind. This feature supports both cases when alert's index mappings contains definition for `actor` and `target`, and also when its not. In this PR, we add mappings of `actor` and `target` to the es_archive of the alerts. This way we are able to test the functionality of this feature instead of being blocked by elastic#224483. <details> <summary>Video 🎥 </summary> https://github.com/user-attachments/assets/bcc86214-6e88-46f3-a990-300bbdc28125 </details> <details> <summary>Screenshots 📸 </summary> **Before (ignore label alignments - screenshot is from a local environment)**  **After (another event is identified with alert - marking it as such and expands the _alert_ details)**  **Before network page - preview**  **After network page - preview identifies if event contains alert**  </details> ### How to test locally 1. Edit `kibana.dev.yml` and add: ```yml uiSettings.overrides.securitySolution:enableGraphVisualization: true ``` 2. Start elasticsearch and kibana locally 3. To add mock data run the following: ```bash node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/security_alerts_modified_mappings \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 ``` 3. Open `Alerts` page in kibana. Update the date-picker to include data from a year ago. Then check one of the alerts details opening the right-side flyout and find the "Graph preview" section in it. 4. Expand graph to show related alerts 5. Enable Asset Inventory in the `Inventory` page (if you don't see the page enable the feature flag in the advanced settings) 6. Add entities mock data ``` node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_api/es_archives/entity_store \ --es-url http://elastic:changeme@localhost:9200 \ --kibana-url http://elastic:changeme@localhost:5601 ``` 7. Open `Alerts` page in kibana. Check that the graph shows the admin entity with it's label ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Summary
resolve #221036
Adds new fields mapping:
actor.entity.id
,target.entity.id
,related.entity
of typekeyword
to the security's alert index.These fields are necessary for querying the alerts index as part of the graph feature (#221037).
related.entity
is currently waiting for ECS approval - elastic/ecs#2360actor.entity.id
,target.entity.id
are added only to security's alertsHow this PR effects:
actor.entity.id
,target.entity.id
,related.entity
Video 🎥
**Before:**Screen.Recording.2025-06-18.at.19.19.18.mov
After:
Screen.Recording.2025-06-18.at.19.21.51.mov
Besides the immediate effect of the ability to fetch data using these fields, this PR is a requirement to move forward with upcoming features like: #224783
Example video of upcoming use 🎥
Screen.Recording.2025-06-29.at.19.42.23.mov
How to test locally
Alerts
page in kibana. Update the date-picker to include data from a year ago. Then check one of the alerts details opening the right-side flyout and find the "Graph preview" section in it.Checklist
Identify risks