Commit graph

1958 commits

Author SHA1 Message Date
Georgii Gorbachev
ba0833f42b
[Security Solution][Detections] Rule execution logging overhaul (#121644)
**Epic:** https://github.com/elastic/kibana/issues/118324
**Tickets:** https://github.com/elastic/kibana/issues/119603, https://github.com/elastic/kibana/issues/119597, https://github.com/elastic/kibana/issues/91265, https://github.com/elastic/kibana/issues/118511

## Summary

The legacy rule execution logging implementation is replaced by a new one that introduces a new model for execution-related data, a new saved object and a new, cleaner interface and implementation.

- [x] The legacy data model is deleted (`IRuleStatusResponseAttributes`, `IRuleStatusSOAttributes`)
- [x] The legacy `siem-detection-engine-rule-status` saved object type is deleted and marked as deleted in `src/core`
- [x] A new data model is introduced (`x-pack/plugins/security_solution/common/detection_engine/schemas/common/rule_monitoring.ts`). This data model doesn't contain a mixture of successful and failed statuses, which should simplify client-side code (e.g. the code of Rule Management and Monitoring tables, as well as Rule Details page).
- [x] A new `siem-detection-engine-rule-execution-info` saved object is introduced (`x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/rule_execution_info/saved_object.ts`).
  - [x] This SO has 1:1 association with the rule SO, so every rule can have 0 or 1 execution info associated with it. This SO is used in order to 1) update the last execution status and metrics and 2) fetch execution data for N rules more efficiently comparing to the legacy SO.
  - [x] The logic of creating or updating this SOs is based on the "upsert" approach (planned in https://github.com/elastic/kibana/issues/118511). It does not fetch the SO by rule id before updating it anymore.
- [x] Rule execution logging logic is rewritten (see `x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log`). The previous rule execution log client is split into two objects: `IRuleExecutionLogClient` for using it from route handlers, and `IRuleExecutionLogger` for writing logs from rule executors.
  - [x] `IRuleExecutionLogger` instance is scoped to the currently executing rule and space id. There's no need to pass rule id, name, type etc to `.logStatusChange()` every time.
- [x] Rule executors and related functions are updated.
- [x] API routes are updated, including the rule preview route which uses a special "spy" implementation of `IRuleExecutionLogger`. A rule returned from an API endpoint now has optional `execution_summary` field of type `RuleExecutionSummary`.
- [x] UI is updated to use the new data model of `RuleExecutionSummary`:
  - [x] Rule Management and Monitoring tables
  - [x] Rule Details page
- [x] A new API route is introduced for fetching rule execution events: `/internal/detection_engine/rules/{ruleId}/execution/events`. It is used for rendering the Failure History tab (last 5 failures) and is intended to be used in the coming UI of Rule Execution Log on the Details page.
- [x] Rule Details page and Failure History tab are updated to use the new data models and API routes.
- [x] I used `react-query` for fetching execution events
  - [x] See `x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_execution_events.tsx`
  - [x] The lib is updated to the latest version
- [x] Tests and fixed and updated according to all the changes
- [x] Components related to rule execution statuses are all moved to `x-pack/plugins/security_solution/public/detections/components/rules/rule_execution_status`.
- [x] I left a lot of `// TODO: https://github.com/elastic/kibana/pull/121644` comments in the code which I'm planning to address and remove in a follow-up PR. Lots of clean up work is needed, but I'd like to unblock the work on Rule Execution Log UI.

## In the next episodes

- Address and remove `// TODO: https://github.com/elastic/kibana/pull/121644` comments in the code
- Make sure that SO id generation for `siem-detection-engine-rule-execution-info` is safe and future-proof. Sync with the Core team. If there are risks, we will need to choose between risks and performance (reading the SO before updating it). It would be easy to submit a fix if needed.
- Add APM integration. Use `withSecuritySpan` in methods of `rule_execution_log` citizens.
- Add comments to the code and README.
- Add test coverage.
- Etc...

### Checklist

Delete any items that are not applicable to this PR.

- [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2022-01-21 00:17:26 +03:00
Nathan Reese
bdb3ce465f
[maps] fetch geometry from fields API (#122431)
* [maps] fetch geometry from fields API

* tslint, eslint

* fix elasticsearch_geo_utils unit test

* more clean up of unit test

* i18n

* clean up

* eslint

* update functional test expects

* eslint

* remove unused turfCircle import

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-01-19 11:50:25 -07:00
renovate[bot]
e9c0fcd025
Update dependency elastic-apm-node to ^3.27.0 (#123322)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-19 12:29:21 +01:00
Baturalp Gurdin
eeb5efcc62
Performance Tests for Login and Home Pages by using Playwright (#119681)
add performance tests for Login and Home pages

- [x] Rename and reduce the number of environment variables for performance test CI job
  - [x] ITERATION_COUNT_ENV =>  PERF_TEST_COUNT
  - [x] DISABLE_CACHE, TEST_RUNNER, TEST_THROTTLE_NETWORK removed
- [x] Use c2-16 queue for performance tests
- [x] Run performance tests by running ES and Kibana separately
- [x] Add warmup phase to performance tests (Not reported to APM). APM Label: PERF_TEST_PHASE
- [x] Add playwright dependency
- [x] Throttle network speed ( downloadThroughput: 750.000 B/s, uploadThroughput: 750.000 B/s, latency: 100 ms )
- [x] Disable cache by using - page.route (‘**’, ….)
- [x] Login and Home pages performance tests.
2022-01-18 14:00:06 +03:00
Patryk Kopyciński
4cbf637a53
Bump cypress@9.2.1 (#122970)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-01-14 13:51:43 +01:00
renovate[bot]
0e1c1e680f
Update APM (#122688)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-01-13 11:15:21 +01:00
Tiago Costa
a6d21cc715
chore(NA): splits types from code on @kbn/ui-shared-deps-npm (#122788) 2022-01-13 02:23:18 +00:00
Patryk Kopyciński
426d09e5fa
Bump cypress@9.2.0 (#115331) 2022-01-11 13:18:02 -07:00
Constance
7ec16063b5
Upgrade EUI to v44.0.0 (#122386)
* Upgrade EUI to 44.0.0

* Account for EuiSuperSelect deprecations

* Update test snapshots

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-01-11 11:31:55 -08:00
renovate[bot]
6bf738fcf0
Update ftr (#122481)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-01-10 15:23:28 -06:00
renovate[bot]
b95ed1f1eb
Update dependency core-js to ^3.20.2 (main) (#122497)
* Update dependency core-js to ^3.20.2

* update yarn.lock

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jonathan Budzenski <jon@elastic.co>
2022-01-10 15:16:06 -06:00
Søren Louv-Jansen
1f891cc67a
Bump backport to 6.1.5 (#122505)
* Bump backport to 6.1.5

* Remove default values
2022-01-10 16:53:08 +01:00
renovate[bot]
526367c831
Update node-forge to v1.1.0 (#122475)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-07 14:04:01 -05:00
Søren Louv-Jansen
5316d08c31
Update Github Action for backport (#122479) 2022-01-06 17:44:24 -07:00
Anton Dosov
00d1ad30f4
[SearchBar] Improve rendering performance (#119189) 2022-01-06 13:22:17 +01:00
Søren Louv-Jansen
d4cc2304ce
Bump backport to v6.1.1 (#122119) 2022-01-05 23:42:41 +01:00
Joe Portner
75ea37b32d
Fix P12 parsing for certificates with "Basic constraints" (#122056) 2022-01-04 07:46:07 -07:00
renovate[bot]
99cdba3c16
Update dependency broadcast-channel to ^4.9.0 (#122000)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-28 15:56:54 -05:00
Tim Sullivan
7e7319b007
[reporting] update pdfmake node module (#121585)
* [Reporting] Upgrade pdfmake module

* change pdf maker to integration test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-27 16:28:44 -07:00
renovate[bot]
5c6a3561e9
Update dependency core-js to ^3.20.1 (main) (#121921)
* Update dependency core-js to ^3.20.1

* fix yarn.lock

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jonathan Budzenski <jon@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-27 13:45:28 -06:00
renovate[bot]
45cf3ce06a
Update ftr (#121927)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-27 13:29:56 -06:00
Mikhail Shustov
38feafad72
Update ES client to canary.37 (#119791)
* upgrade es client to canary 37

* fix error in core

* mute error in test/

* mute incompatible errors

* unskip request_entity_too_large_exception test

* commit autofix

* unskip batch_size_bytes_exceeds_es_content_length test

* fix errors in Core code

* fix or mute errors in data plugin

* fix data_view_management

* fix error index_management

* fix x-pack/test errors

* fix watcher

* fix event_log

* fix data_enhanced

* fix uptime

* fix triggers_actions_ui

* fix transform

* fix reporting

* fix rule_registry

* fix timeline

* fix task_manager

* fix security_solution

* fix rule_registry

* fix fleet

* fix index_management

* fix lens

* fix maps

* fix ml

* fix observability

* bump to canary 8.1-2

* fix error in packages

* fix errors in core

* fix errors in data

* fix errors in discover

* fix some discover tests

* fix errors in telemetry

* fix alerting

* fix errors in apm

* fix errors in event_log

* fix errors in fleet

* fix errors in infra

* fix errors in lists

* mute errors in maps

* fix errors in ml

* fix errors in osquery

* fix errors in security_solution

* fix errors in stack_alerts

* fix errors in task_manager

* fix errors in timelines

* fix errors in transform

* fix errors in watcher

* fix errors in tests

* update docs

* adjust fleet code

* fix problem in fleet

* remove outdated _type from data plugin tests

* fix packages tests

* update type

* fix tests part 2

* Adds product header back to elasticsearch

* Updates API docs

* Fix Discover tests

* update alerting typings

* Fix type errors

* Import Sort type

* Update x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_server.ts

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>

* Remove double negation

* Fix snapshot conflict issues after merge from "main"

Co-authored-by: Christiane Heiligers <christiane.heiligers@elastic.co>
Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alejandro Fernández Haro <afharo@gmail.com>
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
2021-12-24 14:43:53 +01:00
Tiago Costa
64468b7a3e
chore(NA): splits types from code on @kbn/utils (#121924) 2021-12-23 03:18:10 +00:00
Tiago Costa
c3c9195c26
chore(NA): splits types from code on @kbn/utility-types (#121923) 2021-12-23 02:55:13 +00:00
Tiago Costa
0ed61981b7
chore(NA): splits types from code on @kbn/telemetry-tools (#121829) 2021-12-22 09:09:29 -07:00
Tiago Costa
e1a86bac32
chore(NA): splits types from code on @kbn/std (#121815) 2021-12-22 09:45:10 +01:00
Tiago Costa
dc79fa8243
chore(NA): splits types from code on @kbn/server-route-repository (#121810)
* chore(NA): splits types from code on @kbn/server-route-repository

* chore(NA): expose missing type
2021-12-22 03:20:43 +00:00
Tiago Costa
f7a0afc5e1
chore(NA): splits types from code on @kbn/server-http-tools (#121807) 2021-12-22 02:37:29 +00:00
Tiago Costa
0a75d426b9
chore(NA): splits types from code on @kbn/securitysolution-io-ts-utils (#121677)
* chore(NA): splits types from code on @kbn/securitysolution-io-ts-utils

* chore(NA): fix package.json

* chore(NA): merge and solve conflicts with main

* chore(NA): remove any from types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-21 17:24:58 -07:00
Tiago Costa
769efcdd2a
chore(NA): splits types from code on @kbn/securitysolution-list-utils (#121689)
* chore(NA): splits types from code on @kbn/securitysolution-list-utils

* chore(NA): add todos to remove later
2021-12-21 20:38:34 +00:00
Cristina Amico
f2162f175c
[Fleet] Add validation test for openApi files (#121544)
* [Fleet] Add validation test for openApi files

* Fix missing types declaration

* Fix licence issue

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-21 15:37:05 +01:00
Tiago Costa
8357217303
chore(NA): splits types from code on @kbn/interpreter (#121576)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-21 12:23:38 +00:00
Tiago Costa
deabda76a7
chore(NA): splits types from code on @kbn/securitysolutio-utils (#121694) 2021-12-21 04:35:30 +00:00
Tiago Costa
6f882541ab
chore(NA): splits types from code on @kbn/securitysolution-t-grid (#121693) 2021-12-21 04:29:31 +00:00
Tiago Costa
2a193f36e9
chore(NA): splits types from code on @kbn/securitysolution-rules (#121692) 2021-12-21 04:25:19 +00:00
Tiago Costa
9d152da7a1
chore(NA): splits types from code on @kbn/securitysolution-list-hooks (#121688) 2021-12-21 04:05:28 +00:00
Tiago Costa
df8e6199fe
chore(NA): splits types from code on @kbn/securitysolution-list-constants (#121683) 2021-12-21 04:00:46 +00:00
Tiago Costa
d7a7f6b3fb
chore(NA): splits types from code on @kbn/securitysolution-list-api (#121680)
* chore(NA): splits types from code on @kbn/securitysolution-list-api

* chore(NA): export type only

* chore(NA): merge and solve conflicts wth main
2021-12-21 03:46:00 +00:00
Tiago Costa
55bcdf27db
chore(NA): splits types from code on @kbn/securitysolution-io-ts-types (#121676) 2021-12-21 02:58:45 +00:00
Tiago Costa
e203be1613
chore(NA): splits types from code on @kbn/securitysolution-io-ts-list-types (#121672) 2021-12-21 02:54:49 +00:00
Tiago Costa
8525d36e52
chore(NA): splits types from code on @kbn/securitysolution-io-ts-alerting-types (#121670) 2021-12-21 02:14:27 +00:00
Tiago Costa
867862719e
chore(NA): splits types from code on @kbn/securitysolution-hook-utils (#121669) 2021-12-21 02:10:29 +00:00
Tiago Costa
198684effa
chore(NA): splits types from code on @kbn/securitysolution-es-utils (#121664) 2021-12-21 02:05:23 +00:00
Tiago Costa
26024595b0
chore(NA): splits types from code on @kbn/securitysolution-autocomplete (#121662) 2021-12-20 15:43:09 -07:00
Tiago Costa
aa6fe695af
chore(NA): splits types from code on @kbn/rule-data-utils (#121535)
* chore(NA): splits types from code on @kbn/rule-data-utils

* chore(NA): remove old style imports for this pkg

* chore(NA): eslint fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-20 20:41:46 +00:00
Tiago Costa
8496a8b1a3
chore(NA): splits types from code on @kbn/react-field (#121516)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-20 18:43:53 +00:00
Greg Thompson
604409b3de
Upgrade EUI to v43.1.1 (#120935)
* eui to v43.0.0

* update themeprovider types

* update sass import location

* storyshots

* snapshots

* jest

* jest

* timepicker functional test helpers

* snapshots

* timepicker functional test helpers

* invert checked logic

* fix i18n token

* snapshots

* handle new refresh interval operations order

* refactor refresh interval logic, test

* jest

* timepicker popover order

* eui to v43.1.0

* jest

* jest

* jest

* euicode selector

* jest

* functional tests

* functional tests

* timepicker

* bump timeout

* conditional click to close

* clean up

* eui to v43.1.1

* clean up

* loading background

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-20 10:48:36 -06:00
renovate[bot]
64f0e391f0
Update ftr (#121592)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-20 10:25:04 -06:00
Faisal Kanout
f1bb5ea96c
[RAC] [LOGS] [8.1.0] Review readability alert reason messages (#120969)
* Add Log [2]

* Add Log [1]

* Add Log [1]

* Finish update log

* Use moment for time unit

* Fix moment and add types for  moment-duration-format

* Remove unsed value ungroupedRatioAlertReasonDescription

* Script trusted to delete the update keys in JP and CZ

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-20 06:42:00 -07:00
renovate[bot]
d68700cb3c
Update dependency @elastic/charts to v40.2.0 (main) (#120230) 2021-12-18 12:28:15 -06:00