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

[Entity Analytics] [Entity Store] [API] Changes to support event.ingested as a configurable timestamp field for init and enable endpoints #208201

Conversation

abhishekbhatia1710
Copy link
Contributor

Summary

This PR introduces support for configuring the timestamp field for entity store enablement.

By default, the timestamp field is set to @timestamp, but users can opt to use event.ingested or another preferred value based on their requirements.

Entity Store API changes

Entity Store enable

POST kbn:/api/entity_store/enable
{
  "timestampField": "event.ingested"
}

Result

{
  "engines": [
    {
      "status": "started",
      "type": "user",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    },
    {
      "status": "started",
      "type": "host",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    },
    {
      "status": "started",
      "type": "universal",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    }
  ],
  "status": "running"
}
POST kbn:/api/entity_store/enable
{
}

Result

{
  "engines": [
    {
      "status": "started",
      "type": "host",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    },
    {
      "status": "started",
      "type": "user",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    },
    {
      "status": "started",
      "type": "universal",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    }
  ],
  "status": "running"
}

Different entity types can have distinct timestampField values, as described below:

For instance, the host entity uses event.ingested as its timestampField, while other entities default to the @timestamp field.

POST kbn:/api/entity_store/engines/host/init
{
  "timestampField": "event.ingested"
}

POST kbn:/api/entity_store/engines/user/init
{
}

Result

{
  "engines": [
    {
      "status": "started",
      "type": "universal",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    },
    {
      "status": "started",
      "type": "host",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    },
    {
      "status": "started",
      "type": "user",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    }
  ],
  "status": "running"
}

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • 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

Testing steps

  • Check out this PR branch.
  • Start Kibana.
  • Avoid enabling the Entity Store from the UI initially. Instead, enable it via the API by following the steps outlined below.
DELETE kbn:/api/entity_store/engines/user
DELETE kbn:/api/entity_store/engines/host

GET kbn:/api/entity_store/status

 All engines with the same timestamp Field
POST kbn:/api/entity_store/enable
{
  "timestampField": "event.ingested"
}

# All engines with the same timestamp Field
POST kbn:/api/entity_store/enable
{
}

# Different entity with different timestamp Field
POST kbn:/api/entity_store/engines/host/init
{
  "timestampField": "event.ingested"
}

POST kbn:/api/entity_store/engines/user/init
{
}
  1. Afterward, you can test the functionality through the UI. First, clear the entity data from the UI, then start the Entity Store. Note that the UI currently does not offer a way to configure this parameter.

@abhishekbhatia1710 abhishekbhatia1710 added release_note:enhancement v9.0.0 Team:Entity Analytics Security Entity Analytics Team backport:version Backport to applied version labels labels Jan 24, 2025
@abhishekbhatia1710 abhishekbhatia1710 self-assigned this Jan 24, 2025
@abhishekbhatia1710 abhishekbhatia1710 requested review from a team as code owners January 24, 2025 13:57
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

@abhishekbhatia1710 abhishekbhatia1710 changed the title Changes to support event.ingested as a configurable timestamp files for init and enable endpoints [Entity Analytics] [Entity Store] [API] Changes to support event.ingested as a configurable timestamp files for init and enable endpoints Jan 24, 2025
@yctercero
Copy link
Contributor

Hey there! Just passed by this in my email and just a thought - curious if we'll want to think about a more global setting for overriding timestamp. Not sure if the use case is very different, but rules also allow an override. I imagine at some point, setting overrides for every individual feature might be cumbersome. Nothing to block this effort there, just dropping a thought :)

cc @jaredburgettelastic

@abhishekbhatia1710 abhishekbhatia1710 changed the title [Entity Analytics] [Entity Store] [API] Changes to support event.ingested as a configurable timestamp files for init and enable endpoints [Entity Analytics] [Entity Store] [API] Changes to support event.ingested as a configurable timestamp field for init and enable endpoints Jan 27, 2025
@abhishekbhatia1710 abhishekbhatia1710 requested review from a team as code owners January 29, 2025 08:12
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 29, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@abhishekbhatia1710
Copy link
Contributor Author

Hi @yctercero! That’s a great point, and this is being discussed internally. A more global setting for timestamp overrides could definitely help streamline configurations across multiple features, preventing duplication and ensuring consistency.

Right now, the focus is on enabling configurability at the entity store level, but this could be a good direction for a broader discussion, perhaps aligning it with how rules handle overrides to maintain uniformity across the system.

Appreciate you bringing this up! Definitely something worth considering as this functionality evolves. 🚀

@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner January 29, 2025 09:11
@jaredburgettelastic
Copy link
Contributor

@elasticmachine merge upstream

@abhishekbhatia1710 abhishekbhatia1710 removed the request for review from a team January 29, 2025 15:06
@abhishekbhatia1710 abhishekbhatia1710 removed the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 29, 2025
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #20 / Connector renders loading state correctly

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 21.4MB 21.4MB +443.0B

History

cc @abhishekbhatia1710

@@ -181,6 +181,7 @@ export const configSchema = schema.object({
developer: schema.object({
pipelineDebugMode: schema.boolean({ defaultValue: false }),
}),
timestampField: schema.string({ defaultValue: '@timestamp' }),
Copy link
Contributor

Choose a reason for hiding this comment

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

@jaredburgettelastic was it a requirement to add a config value for this? I thought we were avoiding this going forward.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, let's strip this out.

@hop-dev hop-dev enabled auto-merge (squash) January 29, 2025 21:15
Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

LGTM

@hop-dev hop-dev merged commit a060bae into elastic:main Jan 29, 2025
8 checks passed
jaredburgettelastic pushed a commit to jaredburgettelastic/kibana that referenced this pull request Jan 30, 2025
…sted as a configurable timestamp field for init and enable endpoints (elastic#208201)

## Summary

This PR introduces support for configuring the `timestamp` field for
entity store enablement.

By default, the `timestamp` field is set to `@timestamp`, but users can
opt to use `event.ingested` or another preferred value based on their
requirements.

### Entity Store API changes

#### Entity Store enable

```
POST kbn:/api/entity_store/enable
{
  "timestampField": "event.ingested"
}
```

#### Result

```
{
  "engines": [
    {
      "status": "started",
      "type": "user",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    },
    {
      "status": "started",
      "type": "host",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    },
    {
      "status": "started",
      "type": "universal",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    }
  ],
  "status": "running"
}
```

```
POST kbn:/api/entity_store/enable
{
}
```
#### Result

```
{
  "engines": [
    {
      "status": "started",
      "type": "host",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    },
    {
      "status": "started",
      "type": "user",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    },
    {
      "status": "started",
      "type": "universal",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    }
  ],
  "status": "running"
}
```

Different entity types can have distinct `timestampField` values, as
described below:

For instance, the `host` entity uses `event.ingested` as its
`timestampField`, while other entities default to the `@timestamp`
field.

```
POST kbn:/api/entity_store/engines/host/init
{
  "timestampField": "event.ingested"
}

POST kbn:/api/entity_store/engines/user/init
{
}
```

#### Result

```
{
  "engines": [
    {
      "status": "started",
      "type": "universal",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    },
    {
      "status": "started",
      "type": "host",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "event.ingested"
    },
    {
      "status": "started",
      "type": "user",
      "indexPattern": "",
      "filter": "",
      "fieldHistoryLength": 10,
      "timestampField": "@timestamp"
    }
  ],
  "status": "running"
}
```

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] 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.
- [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)

### Testing steps

- Check out this PR branch.
- Start Kibana.
- Avoid enabling the Entity Store from the UI initially. Instead, enable
it via the API by following the steps outlined below.

```
DELETE kbn:/api/entity_store/engines/user
DELETE kbn:/api/entity_store/engines/host

GET kbn:/api/entity_store/status

 All engines with the same timestamp Field
POST kbn:/api/entity_store/enable
{
  "timestampField": "event.ingested"
}

# All engines with the same timestamp Field
POST kbn:/api/entity_store/enable
{
}

# Different entity with different timestamp Field
POST kbn:/api/entity_store/engines/host/init
{
  "timestampField": "event.ingested"
}

POST kbn:/api/entity_store/engines/user/init
{
}
```

4. Afterward, you can test the functionality through the UI. First,
clear the entity data from the UI, then start the Entity Store. Note
that the UI currently does not offer a way to configure this parameter.

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Mark Hopkin <[email protected]>
(cherry picked from commit a060bae)
@jaredburgettelastic
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

jaredburgettelastic added a commit that referenced this pull request Jan 30, 2025
…t.ingested as a configurable timestamp field for init and enable endpoints (#208201) (#208866)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Entity Analytics] [Entity Store] [API] Changes to support
event.ingested as a configurable timestamp field for init and enable
endpoints (#208201)](#208201)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Abhishek
Bhatia","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-29T23:49:13Z","message":"[Entity
Analytics] [Entity Store] [API] Changes to support event.ingested as a
configurable timestamp field for init and enable endpoints
(#208201)\n\n## Summary\n\nThis PR introduces support for configuring
the `timestamp` field for\nentity store enablement.\n\nBy default, the
`timestamp` field is set to `@timestamp`, but users can\nopt to use
`event.ingested` or another preferred value based on
their\nrequirements.\n\n\n### Entity Store API changes\n\n#### Entity
Store enable\n\n```\nPOST kbn:/api/entity_store/enable\n{\n
\"timestampField\": \"event.ingested\"\n}\n```\n\n#### Result
\n\n```\n{\n \"engines\": [\n {\n \"status\": \"started\",\n \"type\":
\"user\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"event.ingested\"\n
},\n {\n \"status\": \"started\",\n \"type\": \"host\",\n
\"indexPattern\": \"\",\n \"filter\": \"\",\n \"fieldHistoryLength\":
10,\n \"timestampField\": \"event.ingested\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"universal\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"event.ingested\"\n }\n ],\n \"status\":
\"running\"\n}\n```\n\n```\nPOST
kbn:/api/entity_store/enable\n{\n}\n```\n#### Result\n\n```\n{\n
\"engines\": [\n {\n \"status\": \"started\",\n \"type\": \"host\",\n
\"indexPattern\": \"\",\n \"filter\": \"\",\n \"fieldHistoryLength\":
10,\n \"timestampField\": \"@timestamp\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"user\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"@timestamp\"\n },\n {\n \"status\": \"started\",\n \"type\":
\"universal\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"@timestamp\"\n }\n
],\n \"status\": \"running\"\n}\n```\n\nDifferent entity types can have
distinct `timestampField` values, as\ndescribed below:\n\nFor instance,
the `host` entity uses `event.ingested` as its\n`timestampField`, while
other entities default to the `@timestamp`\nfield.\n\n```\nPOST
kbn:/api/entity_store/engines/host/init\n{\n \"timestampField\":
\"event.ingested\"\n}\n\nPOST
kbn:/api/entity_store/engines/user/init\n{\n}\n```\n\n####
Result\n\n```\n{\n \"engines\": [\n {\n \"status\": \"started\",\n
\"type\": \"universal\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"@timestamp\"\n },\n
{\n \"status\": \"started\",\n \"type\": \"host\",\n \"indexPattern\":
\"\",\n \"filter\": \"\",\n \"fieldHistoryLength\": 10,\n
\"timestampField\": \"event.ingested\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"user\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"@timestamp\"\n }\n ],\n \"status\": \"running\"\n}\n```\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] This was
checked for breaking HTTP API changes, and any breaking\nchanges have
been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [x] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n\n###
Testing steps\n\n- Check out this PR branch.\n- Start Kibana.\n- Avoid
enabling the Entity Store from the UI initially. Instead, enable\nit via
the API by following the steps outlined below.\n\n```\nDELETE
kbn:/api/entity_store/engines/user\nDELETE
kbn:/api/entity_store/engines/host\n\nGET
kbn:/api/entity_store/status\n\n All engines with the same timestamp
Field\nPOST kbn:/api/entity_store/enable\n{\n \"timestampField\":
\"event.ingested\"\n}\n\n# All engines with the same timestamp
Field\nPOST kbn:/api/entity_store/enable\n{\n}\n\n# Different entity
with different timestamp Field\nPOST
kbn:/api/entity_store/engines/host/init\n{\n \"timestampField\":
\"event.ingested\"\n}\n\nPOST
kbn:/api/entity_store/engines/user/init\n{\n}\n```\n\n4. Afterward, you
can test the functionality through the UI. First,\nclear the entity data
from the UI, then start the Entity Store. Note\nthat the UI currently
does not offer a way to configure this
parameter.\n\n---------\n\nCo-authored-by: kibanamachine
<[email protected]>\nCo-authored-by:
Elastic Machine
<[email protected]>\nCo-authored-by: Mark Hopkin
<[email protected]>","sha":"a060baee83f9be2402cb1a48b0ff2126d8938b56","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","Team:Entity
Analytics","backport:version","v8.18.0"],"title":"[Entity Analytics]
[Entity Store] [API] Changes to support event.ingested as a configurable
timestamp field for init and enable
endpoints","number":208201,"url":"https://github.com/elastic/kibana/pull/208201","mergeCommit":{"message":"[Entity
Analytics] [Entity Store] [API] Changes to support event.ingested as a
configurable timestamp field for init and enable endpoints
(#208201)\n\n## Summary\n\nThis PR introduces support for configuring
the `timestamp` field for\nentity store enablement.\n\nBy default, the
`timestamp` field is set to `@timestamp`, but users can\nopt to use
`event.ingested` or another preferred value based on
their\nrequirements.\n\n\n### Entity Store API changes\n\n#### Entity
Store enable\n\n```\nPOST kbn:/api/entity_store/enable\n{\n
\"timestampField\": \"event.ingested\"\n}\n```\n\n#### Result
\n\n```\n{\n \"engines\": [\n {\n \"status\": \"started\",\n \"type\":
\"user\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"event.ingested\"\n
},\n {\n \"status\": \"started\",\n \"type\": \"host\",\n
\"indexPattern\": \"\",\n \"filter\": \"\",\n \"fieldHistoryLength\":
10,\n \"timestampField\": \"event.ingested\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"universal\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"event.ingested\"\n }\n ],\n \"status\":
\"running\"\n}\n```\n\n```\nPOST
kbn:/api/entity_store/enable\n{\n}\n```\n#### Result\n\n```\n{\n
\"engines\": [\n {\n \"status\": \"started\",\n \"type\": \"host\",\n
\"indexPattern\": \"\",\n \"filter\": \"\",\n \"fieldHistoryLength\":
10,\n \"timestampField\": \"@timestamp\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"user\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"@timestamp\"\n },\n {\n \"status\": \"started\",\n \"type\":
\"universal\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"@timestamp\"\n }\n
],\n \"status\": \"running\"\n}\n```\n\nDifferent entity types can have
distinct `timestampField` values, as\ndescribed below:\n\nFor instance,
the `host` entity uses `event.ingested` as its\n`timestampField`, while
other entities default to the `@timestamp`\nfield.\n\n```\nPOST
kbn:/api/entity_store/engines/host/init\n{\n \"timestampField\":
\"event.ingested\"\n}\n\nPOST
kbn:/api/entity_store/engines/user/init\n{\n}\n```\n\n####
Result\n\n```\n{\n \"engines\": [\n {\n \"status\": \"started\",\n
\"type\": \"universal\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"@timestamp\"\n },\n
{\n \"status\": \"started\",\n \"type\": \"host\",\n \"indexPattern\":
\"\",\n \"filter\": \"\",\n \"fieldHistoryLength\": 10,\n
\"timestampField\": \"event.ingested\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"user\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"@timestamp\"\n }\n ],\n \"status\": \"running\"\n}\n```\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] This was
checked for breaking HTTP API changes, and any breaking\nchanges have
been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [x] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n\n###
Testing steps\n\n- Check out this PR branch.\n- Start Kibana.\n- Avoid
enabling the Entity Store from the UI initially. Instead, enable\nit via
the API by following the steps outlined below.\n\n```\nDELETE
kbn:/api/entity_store/engines/user\nDELETE
kbn:/api/entity_store/engines/host\n\nGET
kbn:/api/entity_store/status\n\n All engines with the same timestamp
Field\nPOST kbn:/api/entity_store/enable\n{\n \"timestampField\":
\"event.ingested\"\n}\n\n# All engines with the same timestamp
Field\nPOST kbn:/api/entity_store/enable\n{\n}\n\n# Different entity
with different timestamp Field\nPOST
kbn:/api/entity_store/engines/host/init\n{\n \"timestampField\":
\"event.ingested\"\n}\n\nPOST
kbn:/api/entity_store/engines/user/init\n{\n}\n```\n\n4. Afterward, you
can test the functionality through the UI. First,\nclear the entity data
from the UI, then start the Entity Store. Note\nthat the UI currently
does not offer a way to configure this
parameter.\n\n---------\n\nCo-authored-by: kibanamachine
<[email protected]>\nCo-authored-by:
Elastic Machine
<[email protected]>\nCo-authored-by: Mark Hopkin
<[email protected]>","sha":"a060baee83f9be2402cb1a48b0ff2126d8938b56"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208201","number":208201,"mergeCommit":{"message":"[Entity
Analytics] [Entity Store] [API] Changes to support event.ingested as a
configurable timestamp field for init and enable endpoints
(#208201)\n\n## Summary\n\nThis PR introduces support for configuring
the `timestamp` field for\nentity store enablement.\n\nBy default, the
`timestamp` field is set to `@timestamp`, but users can\nopt to use
`event.ingested` or another preferred value based on
their\nrequirements.\n\n\n### Entity Store API changes\n\n#### Entity
Store enable\n\n```\nPOST kbn:/api/entity_store/enable\n{\n
\"timestampField\": \"event.ingested\"\n}\n```\n\n#### Result
\n\n```\n{\n \"engines\": [\n {\n \"status\": \"started\",\n \"type\":
\"user\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"event.ingested\"\n
},\n {\n \"status\": \"started\",\n \"type\": \"host\",\n
\"indexPattern\": \"\",\n \"filter\": \"\",\n \"fieldHistoryLength\":
10,\n \"timestampField\": \"event.ingested\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"universal\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"event.ingested\"\n }\n ],\n \"status\":
\"running\"\n}\n```\n\n```\nPOST
kbn:/api/entity_store/enable\n{\n}\n```\n#### Result\n\n```\n{\n
\"engines\": [\n {\n \"status\": \"started\",\n \"type\": \"host\",\n
\"indexPattern\": \"\",\n \"filter\": \"\",\n \"fieldHistoryLength\":
10,\n \"timestampField\": \"@timestamp\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"user\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"@timestamp\"\n },\n {\n \"status\": \"started\",\n \"type\":
\"universal\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"@timestamp\"\n }\n
],\n \"status\": \"running\"\n}\n```\n\nDifferent entity types can have
distinct `timestampField` values, as\ndescribed below:\n\nFor instance,
the `host` entity uses `event.ingested` as its\n`timestampField`, while
other entities default to the `@timestamp`\nfield.\n\n```\nPOST
kbn:/api/entity_store/engines/host/init\n{\n \"timestampField\":
\"event.ingested\"\n}\n\nPOST
kbn:/api/entity_store/engines/user/init\n{\n}\n```\n\n####
Result\n\n```\n{\n \"engines\": [\n {\n \"status\": \"started\",\n
\"type\": \"universal\",\n \"indexPattern\": \"\",\n \"filter\": \"\",\n
\"fieldHistoryLength\": 10,\n \"timestampField\": \"@timestamp\"\n },\n
{\n \"status\": \"started\",\n \"type\": \"host\",\n \"indexPattern\":
\"\",\n \"filter\": \"\",\n \"fieldHistoryLength\": 10,\n
\"timestampField\": \"event.ingested\"\n },\n {\n \"status\":
\"started\",\n \"type\": \"user\",\n \"indexPattern\": \"\",\n
\"filter\": \"\",\n \"fieldHistoryLength\": 10,\n \"timestampField\":
\"@timestamp\"\n }\n ],\n \"status\": \"running\"\n}\n```\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] This was
checked for breaking HTTP API changes, and any breaking\nchanges have
been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [x] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n\n###
Testing steps\n\n- Check out this PR branch.\n- Start Kibana.\n- Avoid
enabling the Entity Store from the UI initially. Instead, enable\nit via
the API by following the steps outlined below.\n\n```\nDELETE
kbn:/api/entity_store/engines/user\nDELETE
kbn:/api/entity_store/engines/host\n\nGET
kbn:/api/entity_store/status\n\n All engines with the same timestamp
Field\nPOST kbn:/api/entity_store/enable\n{\n \"timestampField\":
\"event.ingested\"\n}\n\n# All engines with the same timestamp
Field\nPOST kbn:/api/entity_store/enable\n{\n}\n\n# Different entity
with different timestamp Field\nPOST
kbn:/api/entity_store/engines/host/init\n{\n \"timestampField\":
\"event.ingested\"\n}\n\nPOST
kbn:/api/entity_store/engines/user/init\n{\n}\n```\n\n4. Afterward, you
can test the functionality through the UI. First,\nclear the entity data
from the UI, then start the Entity Store. Note\nthat the UI currently
does not offer a way to configure this
parameter.\n\n---------\n\nCo-authored-by: kibanamachine
<[email protected]>\nCo-authored-by:
Elastic Machine
<[email protected]>\nCo-authored-by: Mark Hopkin
<[email protected]>","sha":"a060baee83f9be2402cb1a48b0ff2126d8938b56"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Abhishek Bhatia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:enhancement Team:Entity Analytics Security Entity Analytics Team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants