← Back to Pull requests

[9.6] [Logs] Bound `size` and column count in the log entries search strategy (#305692) #305929

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 17, 2026 15:19 UTC
Author

Backport

This will backport the following commits from main to 9.6:
- [[Logs] Bound size and column count in the log entries search strategy (#305692)](https://github.com/elastic/kibana/pull/305692)

<!--- Backport version: 12.1.2 -->

Questions ?


Please refer to the Backport tool documentation

<!--BACKPORT [{"author":{"name":"Lucas Francisco López","email":"lucaslopezf@gmail.com"},"sourceCommit":{"committedDate":"2026-11-17T14:54:39Z","message":"[Logs] Bound size and column count in the log entries search strategy (#305692)\n\nThe infra-log-entries search strategy in logs_shared accepted any\nsize and any number of columns. The response holds one value per hit\nand column, and every message column carries its own copy of the\nformatted message. So memory per request grew with size × columns,\nwith no limit.\n\nThis PR bounds both inputs:\n\n- size must be between 1 and LOG_ENTRIES_MAX_SIZE (1000). The\nrequest codec enforces this with inRangeRt from @kbn/io-ts-utils.\n- Request-supplied columns are limited to LOG_ENTRIES_MAX_COLUMNS\n(20). That covers both params.columns and the logColumns of an\ninline log view (type: 'log-view-inline'), which is how an\nunprivileged user can send arbitrary columns. The check runs as soon as\nthe request is decoded, before the log view is resolved. So an oversized\nrequest never reaches Elasticsearch, including polling requests.\n- Persisted log views are not capped. Only users with write\nprivileges on log views can create them. On 8.19, the Logs settings page\nlets users add as many columns as they want, so existing views may\nlegitimately have more than 20.\n\nRejected requests now return 400 (KbnServerError) instead of 500.\nThis applies to every request that fails the codec, which were\npreviously reported as server errors.\n\nIn 9.x, nothing in the shipped UI calls this strategy. In 8.19, Logs\nStream does, and it keeps working with saved views of any width (see the\nscreenshots below).\n\n### How to test\n\n1. Run node scripts/jest\nx-pack/platform/plugins/shared/logs_shared/server/services/log_entries.\n2. Run the new Scout API spec:\nnode scripts/scout run-tests --arch stateful --domain classic --config\nx-pack/platform/plugins/shared/logs_shared/test/scout/api/playwright.config.ts\n It checks that these are rejected with 400:\n - size: 1001\n - 21 request columns\n - an inline log view with 21 columns\n - a polling request with 21 columns\n\nIt also checks that a persisted log view with 21 columns, and an inline\nview at the 20-column limit, still return entries.\n3. On 8.19 (optional):\n - Enable the observability:enableLogsStream advanced setting.\n - Open Logs → Settings, add more than 20 columns, and click Apply.\n - Open Logs → Stream. Entries should render without errors.\n\n### Screenshots (8.19)\n\nLogs settings with 22 columns, saved through the UI\n\n<img width=\"1920\" height=\"2721\" alt=\"02-8 19-settings-22-columns-saved\"\nsrc=\"https://github.com/user-attachments/assets/4651d393-1eca-437e-baac-5aaf926258fc\"\n/>\n\n\nLogs Stream rendering entries with that 22-column view\n\n<img width=\"1920\" height=\"1080\" alt=\"03-8 19-stream-22-columns-renders\"\nsrc=\"https://github.com/user-attachments/assets/2ca9220b-29e4-45e7-9166-34ab35efe9f7\"\n/>\n\n\n### Checklist\n\n- [x] Unit or functional\ntests\nwere updated or added to match the most common scenarios\n- [x] This was checked for breaking HTTP API changes. The route is\ninternal, persisted log views are unaffected, and the request limits are\nwell above what its only client (8.19 LogStream) sends.\n- [ ] The correct release_note: type label (or release_note:skip)\nis applied, the PR title reads as a release note, and the description\nhas a ## Release note section if a custom summary is needed, per the\nguidelines.\n- [ ] Review the backport\nguidelines\nand apply applicable backport: labels.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"221a9d08a5fc3315cbc9ea04212da93a40add82b","branchLabelMapping":{"^v9.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","Team:obs-signals-logs","v9.7.0"],"title":"[Logs] Bound size and column count in the log entries search strategy","number":305692,"url":"https://github.com/elastic/kibana/pull/305692","mergeCommit":{"message":"[Logs] Bound size and column count in the log entries search strategy (#305692)\n\nThe infra-log-entries search strategy in logs_shared accepted any\nsize and any number of columns. The response holds one value per hit\nand column, and every message column carries its own copy of the\nformatted message. So memory per request grew with size × columns,\nwith no limit.\n\nThis PR bounds both inputs:\n\n- size must be between 1 and LOG_ENTRIES_MAX_SIZE (1000). The\nrequest codec enforces this with inRangeRt from @kbn/io-ts-utils.\n- Request-supplied columns are limited to LOG_ENTRIES_MAX_COLUMNS\n(20). That covers both params.columns and the logColumns of an\ninline log view (type: 'log-view-inline'), which is how an\nunprivileged user can send arbitrary columns. The check runs as soon as\nthe request is decoded, before the log view is resolved. So an oversized\nrequest never reaches Elasticsearch, including polling requests.\n- Persisted log views are not capped. Only users with write\nprivileges on log views can create them. On 8.19, the Logs settings page\nlets users add as many columns as they want, so existing views may\nlegitimately have more than 20.\n\nRejected requests now return 400 (KbnServerError) instead of 500.\nThis applies to every request that fails the codec, which were\npreviously reported as server errors.\n\nIn 9.x, nothing in the shipped UI calls this strategy. In 8.19, Logs\nStream does, and it keeps working with saved views of any width (see the\nscreenshots below).\n\n### How to test\n\n1. Run node scripts/jest\nx-pack/platform/plugins/shared/logs_shared/server/services/log_entries.\n2. Run the new Scout API spec:\nnode scripts/scout run-tests --arch stateful --domain classic --config\nx-pack/platform/plugins/shared/logs_shared/test/scout/api/playwright.config.ts\n It checks that these are rejected with 400:\n - size: 1001\n - 21 request columns\n - an inline log view with 21 columns\n - a polling request with 21 columns\n\nIt also checks that a persisted log view with 21 columns, and an inline\nview at the 20-column limit, still return entries.\n3. On 8.19 (optional):\n - Enable the observability:enableLogsStream advanced setting.\n - Open Logs → Settings, add more than 20 columns, and click Apply.\n - Open Logs → Stream. Entries should render without errors.\n\n### Screenshots (8.19)\n\nLogs settings with 22 columns, saved through the UI\n\n<img width=\"1920\" height=\"2721\" alt=\"02-8 19-settings-22-columns-saved\"\nsrc=\"https://github.com/user-attachments/assets/4651d393-1eca-437e-baac-5aaf926258fc\"\n/>\n\n\nLogs Stream rendering entries with that 22-column view\n\n<img width=\"1920\" height=\"1080\" alt=\"03-8 19-stream-22-columns-renders\"\nsrc=\"https://github.com/user-attachments/assets/2ca9220b-29e4-45e7-9166-34ab35efe9f7\"\n/>\n\n\n### Checklist\n\n- [x] Unit or functional\ntests\nwere updated or added to match the most common scenarios\n- [x] This was checked for breaking HTTP API changes. The route is\ninternal, persisted log views are unaffected, and the request limits are\nwell above what its only client (8.19 LogStream) sends.\n- [ ] The correct release_note: type label (or release_note:skip)\nis applied, the PR title reads as a release note, and the description\nhas a ## Release note section if a custom summary is needed, per the\nguidelines.\n- [ ] Review the backport\nguidelines\nand apply applicable backport: labels.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"221a9d08a5fc3315cbc9ea04212da93a40add82b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.7.0","branchLabelMappingKey":"^v9.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/305692","number":305692,"mergeCommit":{"message":"[Logs] Bound size and column count in the log entries search strategy (#305692)\n\nThe infra-log-entries search strategy in logs_shared accepted any\nsize and any number of columns. The response holds one value per hit\nand column, and every message column carries its own copy of the\nformatted message. So memory per request grew with size × columns,\nwith no limit.\n\nThis PR bounds both inputs:\n\n- size must be between 1 and LOG_ENTRIES_MAX_SIZE (1000). The\nrequest codec enforces this with inRangeRt from @kbn/io-ts-utils.\n- Request-supplied columns are limited to LOG_ENTRIES_MAX_COLUMNS\n(20). That covers both params.columns and the logColumns of an\ninline log view (type: 'log-view-inline'), which is how an\nunprivileged user can send arbitrary columns. The check runs as soon as\nthe request is decoded, before the log view is resolved. So an oversized\nrequest never reaches Elasticsearch, including polling requests.\n- Persisted log views are not capped. Only users with write\nprivileges on log views can create them. On 8.19, the Logs settings page\nlets users add as many columns as they want, so existing views may\nlegitimately have more than 20.\n\nRejected requests now return 400 (KbnServerError) instead of 500.\nThis applies to every request that fails the codec, which were\npreviously reported as server errors.\n\nIn 9.x, nothing in the shipped UI calls this strategy. In 8.19, Logs\nStream does, and it keeps working with saved views of any width (see the\nscreenshots below).\n\n### How to test\n\n1. Run node scripts/jest\nx-pack/platform/plugins/shared/logs_shared/server/services/log_entries.\n2. Run the new Scout API spec:\nnode scripts/scout run-tests --arch stateful --domain classic --config\nx-pack/platform/plugins/shared/logs_shared/test/scout/api/playwright.config.ts\n It checks that these are rejected with 400:\n - size: 1001\n - 21 request columns\n - an inline log view with 21 columns\n - a polling request with 21 columns\n\nIt also checks that a persisted log view with 21 columns, and an inline\nview at the 20-column limit, still return entries.\n3. On 8.19 (optional):\n - Enable the observability:enableLogsStream advanced setting.\n - Open Logs → Settings, add more than 20 columns, and click Apply.\n - Open Logs → Stream. Entries should render without errors.\n\n### Screenshots (8.19)\n\nLogs settings with 22 columns, saved through the UI\n\n<img width=\"1920\" height=\"2721\" alt=\"02-8 19-settings-22-columns-saved\"\nsrc=\"https://github.com/user-attachments/assets/4651d393-1eca-437e-baac-5aaf926258fc\"\n/>\n\n\nLogs Stream rendering entries with that 22-column view\n\n<img width=\"1920\" height=\"1080\" alt=\"03-8 19-stream-22-columns-renders\"\nsrc=\"https://github.com/user-attachments/assets/2ca9220b-29e4-45e7-9166-34ab35efe9f7\"\n/>\n\n\n### Checklist\n\n- [x] Unit or functional\ntests\nwere updated or added to match the most common scenarios\n- [x] This was checked for breaking HTTP API changes. The route is\ninternal, persisted log views are unaffected, and the request limits are\nwell above what its only client (8.19 LogStream) sends.\n- [ ] The correct release_note: type label (or release_note:skip)\nis applied, the PR title reads as a release note, and the description\nhas a ## Release note section if a custom summary is needed, per the\nguidelines.\n- [ ] Review the backport\nguidelines\nand apply applicable backport: labels.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"221a9d08a5fc3315cbc9ea04212da93a40add82b"}}]}] BACKPORT-->

Diff: 650 lines (+487 / -163) across 8 files Reviewer: github-actions[bot] Review duration: 0m
All Vouch review confidence checks passed
Residual risk 0.45 = Change Risk (0.52) × (1 − Review Confidence (0.14)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
0.52
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 3% · Reviewer familiarity: 35%
13%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.388
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #305929"
general weight: 0.35
Assignees
Unassigned
Labels
risk: medium confidence: 13.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 52% (MEDIUM) · Higher = larger blast radius
52%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 13.7% · Lower = rushed or shallow review
13.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 44.9% · Moderate risk
44.9%
Repository