Commit dd70d94
# Backport
This will backport the following commits from `main` to `9.4`:
- [[Entity Store] Cap window size
(#268170)](#268170)
<!--- Backport version: 11.0.2 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Rômulo
Farias","email":"romulo.farias@elastic.co"},"sourceCommit":{"committedDate":"2026-05-08T13:18:48Z","message":"[Entity
Store] Cap window size (#268170)\n\nIn lagging environments the
entity-store extraction window grows\nunboundedly. `getExtractionWindow`
always sets `toDateISO = now - delay`\nwhile `fromDateISO` advances only
via `lastExecutionTimestamp /\npaginationTimestamp`. If a run cannot
keep up, each subsequent run sees\na wider window. The probe
(`buildLogPaginationCursorProbeEsql`) sorts\nevery doc in that window in
ES|QL, so probe cost grows with window size\n— feeding a death-spiral
where slow runs widen the window which slows\nthe next run
further.\n\nWe want a hard cap on the width of each probe's window so
that probe\ncost stays bounded regardless of how far behind the engine
is. The cap\nis purely a cost-bounding device for the probe — it does
not\nartificially defer catch-up to a later run.\n\nWithin a single
extractLogs execution, once a capped sub-window is\ndrained we
immediately advance to the next sub-window and continue,\nuntil we reach
the effective window end (now - delay). Only when a run\nis interrupted
(crash, abort, hitting a slow probe) do we resume on the\nnext scheduled
run from the last persisted lastExecutionTimestamp.\n\n### How it
works\n\nWhen the gap between `fromDateISO` and the effective window end
(`now -\ndelay`) exceeds `maxTimeWindowSize + GRACE_PERIOD` (default
`15m +\n30s`), the run processes the time range as a sequence of
capped\n`[fromSub, toSub]` sub-windows of width `maxTimeWindowSize`,
advancing\nwithin a single execution until the effective end is
reached.\nSub-windows are an in-memory iteration concept — the
saved-object schema\nis unaware of them. Crash recovery uses the
per-slice persistence\nemitted by the inner outer-loop (last
`paginationTimestamp` /\n`checkpointTimestamp` written). Manual
`specificWindow` /\n`windowOverride` runs bypass capping and run as a
single pass.\n\n\n### Added\n\n- `maxTimeWindowSize` parameter to the
global configuration, available\non install and update paths. Also
exposed via status api\n\n\n### Why default 15m\n\n`15m` seems to be an
ok cap based on the default `3h` look back period.\nA too short `1m`
will cause 180 queries to elasticsearch. `15m` will\ncause only
12.\n\nThis will need to be configured on heavy environments where `15m`
worth\nof data account for millions of
logs.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"555237a0dba491c31901c1b3323f667ecb580a0d","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","v9.4.0","reviewer:macroscope","v9.5.0","v9.4.1"],"title":"[Entity
Store] Cap window
size","number":268170,"url":"https://github.com/elastic/kibana/pull/268170","mergeCommit":{"message":"[Entity
Store] Cap window size (#268170)\n\nIn lagging environments the
entity-store extraction window grows\nunboundedly. `getExtractionWindow`
always sets `toDateISO = now - delay`\nwhile `fromDateISO` advances only
via `lastExecutionTimestamp /\npaginationTimestamp`. If a run cannot
keep up, each subsequent run sees\na wider window. The probe
(`buildLogPaginationCursorProbeEsql`) sorts\nevery doc in that window in
ES|QL, so probe cost grows with window size\n— feeding a death-spiral
where slow runs widen the window which slows\nthe next run
further.\n\nWe want a hard cap on the width of each probe's window so
that probe\ncost stays bounded regardless of how far behind the engine
is. The cap\nis purely a cost-bounding device for the probe — it does
not\nartificially defer catch-up to a later run.\n\nWithin a single
extractLogs execution, once a capped sub-window is\ndrained we
immediately advance to the next sub-window and continue,\nuntil we reach
the effective window end (now - delay). Only when a run\nis interrupted
(crash, abort, hitting a slow probe) do we resume on the\nnext scheduled
run from the last persisted lastExecutionTimestamp.\n\n### How it
works\n\nWhen the gap between `fromDateISO` and the effective window end
(`now -\ndelay`) exceeds `maxTimeWindowSize + GRACE_PERIOD` (default
`15m +\n30s`), the run processes the time range as a sequence of
capped\n`[fromSub, toSub]` sub-windows of width `maxTimeWindowSize`,
advancing\nwithin a single execution until the effective end is
reached.\nSub-windows are an in-memory iteration concept — the
saved-object schema\nis unaware of them. Crash recovery uses the
per-slice persistence\nemitted by the inner outer-loop (last
`paginationTimestamp` /\n`checkpointTimestamp` written). Manual
`specificWindow` /\n`windowOverride` runs bypass capping and run as a
single pass.\n\n\n### Added\n\n- `maxTimeWindowSize` parameter to the
global configuration, available\non install and update paths. Also
exposed via status api\n\n\n### Why default 15m\n\n`15m` seems to be an
ok cap based on the default `3h` look back period.\nA too short `1m`
will cause 180 queries to elasticsearch. `15m` will\ncause only
12.\n\nThis will need to be configured on heavy environments where `15m`
worth\nof data account for millions of
logs.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"555237a0dba491c31901c1b3323f667ecb580a0d"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/268170","number":268170,"mergeCommit":{"message":"[Entity
Store] Cap window size (#268170)\n\nIn lagging environments the
entity-store extraction window grows\nunboundedly. `getExtractionWindow`
always sets `toDateISO = now - delay`\nwhile `fromDateISO` advances only
via `lastExecutionTimestamp /\npaginationTimestamp`. If a run cannot
keep up, each subsequent run sees\na wider window. The probe
(`buildLogPaginationCursorProbeEsql`) sorts\nevery doc in that window in
ES|QL, so probe cost grows with window size\n— feeding a death-spiral
where slow runs widen the window which slows\nthe next run
further.\n\nWe want a hard cap on the width of each probe's window so
that probe\ncost stays bounded regardless of how far behind the engine
is. The cap\nis purely a cost-bounding device for the probe — it does
not\nartificially defer catch-up to a later run.\n\nWithin a single
extractLogs execution, once a capped sub-window is\ndrained we
immediately advance to the next sub-window and continue,\nuntil we reach
the effective window end (now - delay). Only when a run\nis interrupted
(crash, abort, hitting a slow probe) do we resume on the\nnext scheduled
run from the last persisted lastExecutionTimestamp.\n\n### How it
works\n\nWhen the gap between `fromDateISO` and the effective window end
(`now -\ndelay`) exceeds `maxTimeWindowSize + GRACE_PERIOD` (default
`15m +\n30s`), the run processes the time range as a sequence of
capped\n`[fromSub, toSub]` sub-windows of width `maxTimeWindowSize`,
advancing\nwithin a single execution until the effective end is
reached.\nSub-windows are an in-memory iteration concept — the
saved-object schema\nis unaware of them. Crash recovery uses the
per-slice persistence\nemitted by the inner outer-loop (last
`paginationTimestamp` /\n`checkpointTimestamp` written). Manual
`specificWindow` /\n`windowOverride` runs bypass capping and run as a
single pass.\n\n\n### Added\n\n- `maxTimeWindowSize` parameter to the
global configuration, available\non install and update paths. Also
exposed via status api\n\n\n### Why default 15m\n\n`15m` seems to be an
ok cap based on the default `3h` look back period.\nA too short `1m`
will cause 180 queries to elasticsearch. `15m` will\ncause only
12.\n\nThis will need to be configured on heavy environments where `15m`
worth\nof data account for millions of
logs.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"555237a0dba491c31901c1b3323f667ecb580a0d"}}]}]
BACKPORT-->
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
1 parent d0ba5e1 commit dd70d94
19 files changed
Lines changed: 1053 additions & 161 deletions
File tree
- oas_docs/output
- packages/kbn-check-saved-objects-cli/src/migrations/__fixtures__/entity-store-global-state
- src/core/server/integration_tests/ci_checks/saved_objects
- x-pack/solutions/security/plugins/entity_store/server
- domain
- logs_extraction
- saved_objects/global_state
- routes
- apis
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62714 | 62714 | | |
62715 | 62715 | | |
62716 | 62716 | | |
| 62717 | + | |
| 62718 | + | |
| 62719 | + | |
| 62720 | + | |
62717 | 62721 | | |
62718 | 62722 | | |
62719 | 62723 | | |
| |||
62730 | 62734 | | |
62731 | 62735 | | |
62732 | 62736 | | |
| 62737 | + | |
| 62738 | + | |
| 62739 | + | |
62733 | 62740 | | |
62734 | 62741 | | |
62735 | 62742 | | |
| |||
70346 | 70353 | | |
70347 | 70354 | | |
70348 | 70355 | | |
| 70356 | + | |
| 70357 | + | |
| 70358 | + | |
| 70359 | + | |
| 70360 | + | |
70349 | 70361 | | |
70350 | 70362 | | |
70351 | 70363 | | |
| |||
70367 | 70379 | | |
70368 | 70380 | | |
70369 | 70381 | | |
| 70382 | + | |
| 70383 | + | |
| 70384 | + | |
| 70385 | + | |
70370 | 70386 | | |
70371 | 70387 | | |
70372 | 70388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66707 | 66707 | | |
66708 | 66708 | | |
66709 | 66709 | | |
| 66710 | + | |
| 66711 | + | |
| 66712 | + | |
| 66713 | + | |
66710 | 66714 | | |
66711 | 66715 | | |
66712 | 66716 | | |
| |||
66723 | 66727 | | |
66724 | 66728 | | |
66725 | 66729 | | |
| 66730 | + | |
| 66731 | + | |
| 66732 | + | |
66726 | 66733 | | |
66727 | 66734 | | |
66728 | 66735 | | |
| |||
74339 | 74346 | | |
74340 | 74347 | | |
74341 | 74348 | | |
| 74349 | + | |
| 74350 | + | |
| 74351 | + | |
| 74352 | + | |
| 74353 | + | |
74342 | 74354 | | |
74343 | 74355 | | |
74344 | 74356 | | |
| |||
74360 | 74372 | | |
74361 | 74373 | | |
74362 | 74374 | | |
| 74375 | + | |
| 74376 | + | |
| 74377 | + | |
| 74378 | + | |
74363 | 74379 | | |
74364 | 74380 | | |
74365 | 74381 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
| 669 | + | |
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
| |||
1480 | 1481 | | |
1481 | 1482 | | |
1482 | 1483 | | |
1483 | | - | |
| 1484 | + | |
1484 | 1485 | | |
1485 | 1486 | | |
1486 | 1487 | | |
| |||
1648 | 1649 | | |
1649 | 1650 | | |
1650 | 1651 | | |
1651 | | - | |
| 1652 | + | |
1652 | 1653 | | |
1653 | 1654 | | |
1654 | 1655 | | |
| |||
Lines changed: 43 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
95 | 130 | | |
96 | 131 | | |
97 | 132 | | |
| |||
126 | 161 | | |
127 | 162 | | |
128 | 163 | | |
| 164 | + | |
| 165 | + | |
129 | 166 | | |
130 | 167 | | |
131 | 168 | | |
132 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
133 | 174 | | |
134 | 175 | | |
135 | 176 | | |
| |||
Lines changed: 101 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
| |||
472 | 475 | | |
473 | 476 | | |
474 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
475 | 576 | | |
0 commit comments