Skip to content

Add 'Generic' Entity Engine Definition#211232

Merged
romulets merged 48 commits intoelastic:mainfrom
romulets:generic-entity-engine
Apr 15, 2025
Merged

Add 'Generic' Entity Engine Definition#211232
romulets merged 48 commits intoelastic:mainfrom
romulets:generic-entity-engine

Conversation

@romulets
Copy link
Copy Markdown
Member

@romulets romulets commented Feb 14, 2025

Summary

Introduce a new Entity Engine Definition called Generic. The larger context on why we are introducing a new entity definition is described on this private github issue.

The tldr; is that we would like to have an entity store with all the entities described by the entity ecs field. The decision to call generic entity definition comes from the fact that any entity can be described with the entity field - user, host, service, database, queue, subscription and so on. Therefore it makes sense to have the concept called generic entity, meanwhile the existent entity definitions will be called concrete entities, because they describe a very concrete type of entity (currently user, host, service).

Other changes included on this PR:

  • Don't override entity.name with entity.id, only set if no value is found
  • Migrate the usage of entity.type as the entity definition type to entity.EngineMetadata.Type
  • Changes touching Entity Analytics code around getRiskEngineEntityTypes and getAssetCriticalityEntityTypes. There was a somewhat unnecessary and duplicated logic in these functions which essentially described the concrete entity definitions to be used by entity analytics flows. A new function called getEntityAnalyticsEntityTypes was introduced which unifies this logic and returns the entity types that Entity Analytics care about.

Video of a scroll through the entities processed by the generic entity store, source of the data is cloudbeat asset management integration.

no-sound.mov

How to test:

  • In Advanced Settings (/app/management/kibana/settings), enable securitySolution:enableAssetInventory
image
  • In Entity Store management (/security/entity_analytics_entity_store) enable entity store
image
  • Verify Generic Engine Status
image
  • Ingest documents with entity.id and entity.* fields. Personally I run cloudbeat asset discovery locally

  • Verify ingested documents in .entities.v1.latest.security_generic_default

image

--

OBS: Also test enabling the store without the uiSetting enabled, so you can make sure that it doesn't enable

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

Identify risks

Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.

  • I see risk on performance, given the amount of aggregations the generated transform does
    • tested, although we see a higher spike in CPU than before, it's behind a feature flag and it's going to be used in controlled data sets (entity centric logs that contain entity.id field) we decided it's good enough to go.
  • Enablement/disablement of entity store in a different uiSetting configuration.
    • Enable entity store with securitySolution:enableAssetInventory disabled. Then enable securitySolution:enableAssetInventory ==> No generic entity definition installed. You can manually install it in the EntityStore status page
    • Enable entity store with securitySolution:enableAssetInventory enabled. Then disable securitySolution:enableAssetInventory definition ==> hanging assets of generic entity store that can be deleted manually

@romulets romulets changed the title Add 'Generic' Entity Engine Add 'Generic' Entity Engine Description Mar 17, 2025
@romulets romulets changed the title Add 'Generic' Entity Engine Description Add 'Generic' Entity Engine Definition Mar 17, 2025
@romulets romulets added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related backport:skip This PR does not require backporting labels Mar 17, 2025
@romulets romulets marked this pull request as ready for review March 17, 2025 16:04
@romulets romulets requested a review from a team as a code owner March 17, 2025 16:04
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

@romulets romulets requested a review from opauloh March 17, 2025 16:07
@romulets romulets assigned maxcold and unassigned maxcold Mar 17, 2025
@romulets romulets requested a review from maxcold March 17, 2025 16:09
@romulets romulets requested a review from a team as a code owner April 11, 2025 13:58
Copy link
Copy Markdown
Contributor

@lgestc lgestc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

investigations changes lgtm!

Copy link
Copy Markdown
Contributor

@dplumlee dplumlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule management changes lgtm

@romulets romulets requested a review from JordanSh April 14, 2025 15:09
@machadoum
Copy link
Copy Markdown
Member

Hey @romulets, great job! 👏 👏

I found something unexpected in the Entity Analytics dashboard. Are we intentionally displaying a panel for the Generic Entity Risk score?
Screenshot 2025-04-15 at 09 11 15

Besides that, everything looks good. I also desk-tested the most common flows.

@romulets
Copy link
Copy Markdown
Member Author

@machadoum it's not intentional! Awesome catch!!! I'll fix right away

@romulets romulets enabled auto-merge (squash) April 15, 2025 08:13
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 15, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 7221 7219 -2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
inventory 191.9KB 191.9KB +71.0B
securitySolution 9.0MB 9.0MB +495.0B
total +566.0B

History

cc @romulets

@romulets romulets merged commit b1ffcf3 into elastic:main Apr 15, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:build-serverless-image ci:cloud-deploy Create or update a Cloud deployment ci:project-deploy-security Create a Security Serverless Project release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.