kibana/x-pack/plugins
Georgii Gorbachev 7fd6539dca
[RAC] Rule monitoring: Event Log for Rule Registry (#98353)
**Needed for:** rule execution log for Security https://github.com/elastic/kibana/pull/94143
**Related to:**

- alerts-as-data: https://github.com/elastic/kibana/issues/93728, https://github.com/elastic/kibana/issues/93729, https://github.com/elastic/kibana/issues/93730
- RFC for index naming https://github.com/elastic/kibana/issues/98912

## Summary

This PR adds a mechanism for writing to / reading from / bootstrapping indices for RAC project into the `rule_registry` plugin. Particularly, indices for alerts-as-data and rule execution events. This implementation is similar to existing implementations like `event_log` plugin (see https://github.com/elastic/kibana/pull/98353#issuecomment-833045980 for historical perspective), but we're going to converge all of them into 1 or 2 implementations. At least we should have a single one in `rule_registry` itself.

In this PR I tried to incorporate most of the feedback received in the RFC (https://github.com/elastic/kibana/issues/98912), but if you notice I missed/forgot something, please let me know in the comments.

Done in this PR:

- [x] Schema-agnostic APIs for working with Elasticsearch.
- [x] Schema-aware log definition and bootstrapping API (creating hierarchical logs).
- [x] Schema-aware write API (logging events).
- [x] Schema-aware read API (searching logs, filtering, sorting, pagination, aggregation).
- [x] Support for Kibana spaces, space-aware index bootstrapping (either at rule creation or rule execution time).

As for reviewing this PR, perhaps it might be easier to start with:

- checking description of https://github.com/elastic/kibana/issues/98912
- checking usage examples https://github.com/elastic/kibana/pull/98353/files#diff-c049ff2198cc69bd50a69e92d29e88da7e10b9a152bdaceaf3d41826e712c12b
- checking public api https://github.com/elastic/kibana/pull/98353/files#diff-8e9ef0dbcbc60b1861d492a03865b2ae76a56ec38ada61898c991d3a74bd6268

## Next steps

Next steps towards rule execution log in Security (https://github.com/elastic/kibana/pull/94143):

- define actual schema for rule execution events
- inject instance of rule execution log into Security rule executors and route handlers
- implement actual execution logging in rule executors
- update route handlers to start fetching execution events and metrics from the log instead of custom saved objects

Next steps in the context of RAC and unified implementation:

- converge this implementation with `RuleDataService` implementation
  - implement robust index bootstrapping
  - reconsider using FieldMap as a generic type parameter
  - implement validation for documents being indexed
- cover the final implementation with tests
- write comprehensive docs: update plugin README, add JSDoc comments to all public interfaces
2021-05-27 18:28:19 +03:00
..
actions [Alerting] Enabling import of rules and connectors (#99857) 2021-05-14 07:43:09 -07:00
alerting [alerting] add ignore_above to alerts params mappings to handle immense params (#100726) 2021-05-27 09:17:12 -04:00
apm [RAC] Rule monitoring: Event Log for Rule Registry (#98353) 2021-05-27 18:28:19 +03:00
banners Do not mutate config in place during deprecations (#99629) 2021-05-11 05:41:48 -04:00
canvas remove src/legacy and src/optimizer from configs (#100538) 2021-05-26 22:01:33 +02:00
cases [triggersActionsUi] Reduce page load bundle to under 100kB (#97770) 2021-05-25 19:00:29 -07:00
cloud Don't query for the current user on anonymous pages (#99511) 2021-05-06 17:04:56 -04:00
console_extensions
cross_cluster_replication [CCR] Replace EuiCodeEditor with EuiCodeBlock (#100122) 2021-05-20 14:05:42 -04:00
dashboard_enhanced feat: 🎸 close drilldown manager on view mode switch (#99309) 2021-05-06 00:26:13 +02:00
dashboard_mode
data_enhanced [Search Sessions] Fix display of expired session state in management (#98915) 2021-05-04 12:02:17 +02:00
discover_enhanced Disable context menu "Explore underlying data" by default (#98039) 2021-04-26 13:20:43 +02:00
drilldowns
embeddable_enhanced feat: 🎸 enable drilldown actions in "edit" mode (#96023) 2021-04-12 16:44:48 +02:00
encrypted_saved_objects Sharing saved objects phase 3 (#94383) 2021-05-14 14:46:17 -04:00
enterprise_search [App Search] Allow user to manage source engines through Kibana UX (#98866) 2021-05-15 01:10:53 -04:00
event_log [RAC] Rule registry plugin (#95903) 2021-04-09 10:35:44 +02:00
features Remove circular dependency between features and security (#100206) 2021-05-19 11:33:44 -04:00
file_data_visualizer [ML] Data vizualizer: add choropleth map for index and file (#99434) 2021-05-11 13:40:06 -04:00
file_upload [Maps] Add draw wizard (#100278) 2021-05-26 11:21:38 -04:00
fleet [Fleet] Support browsing granular integrations (#99866) 2021-05-26 09:59:09 -07:00
global_search
global_search_bar Clearing the global search bar will reset suggestions (#88637) 2021-05-13 11:35:03 -04:00
global_search_providers [Security Solution] Application register deepLinks instead of meta.searchDeepLinks (#100129) 2021-05-25 14:49:51 +02:00
graph Remove chrome.navLinks.update (#99633) 2021-05-24 13:00:45 -05:00
grokdebugger
index_lifecycle_management Reintroduce 96111: Provide guidance of "Custom" allocation behavior in ILM (#99007) 2021-05-03 12:29:57 -07:00
index_management [Index management] Add selected index count (#99652) 2021-05-11 14:10:34 +01:00
infra [Metrics UI] use EuiTooltip to control tooltip component and simplify ConditionalTooltip (#99224) 2021-05-25 08:51:24 -04:00
ingest_pipelines [Ingest pipelines] add support for fingerprint processor (#100541) 2021-05-26 18:29:05 +02:00
lens [Lens] Improve caching with more stable Elasticsearch requests (#100414) 2021-05-27 15:25:10 +02:00
license_api_guard Fix typo in license_api_guard README name and import http server mocks from public interface (#97334) 2021-04-18 20:28:13 -07:00
license_management initial migration (#97795) 2021-04-23 17:14:54 +02:00
licensing Remove chrome.navLinks.update (#99633) 2021-05-24 13:00:45 -05:00
lists Removes event filters feature flag and exposes this feature by default (#100389) 2021-05-25 15:19:42 +02:00
logstash migrate logstash plugin to new ES client (#98064) 2021-04-27 10:25:50 +02:00
maps [Maps] Isolate mapbox-gl types and align downstream package versions. (#100610) 2021-05-26 21:09:38 -04:00
metrics_entities [Security Solutions] (Phase 1) Adds an application cache called metrics entities and integrates it within Security Solutions behind a feature flag (#96446) 2021-04-30 12:36:06 -06:00
ml [ML] Adds functional tests for anomaly detection job custom URLs (#100455) 2021-05-26 17:48:03 +01:00
monitoring [Monitoring] Added missing cgroup memory (#99602) 2021-05-12 11:24:05 -04:00
observability [RAC] Rule monitoring: Event Log for Rule Registry (#98353) 2021-05-27 18:28:19 +03:00
osquery Ban use of lodash.template (#100277) 2021-05-19 10:06:52 -04:00
painless_lab
remote_clusters [Remote clusters] Fixed skipped test for search bar (#97472) 2021-05-05 13:05:35 +02:00
reporting [Reporting] Use the deprecations service to advise critical config changes (#100427) 2021-05-26 17:31:55 -07:00
rollup Use doc link services in rollups (#99137) 2021-05-10 10:01:19 -07:00
rule_registry [RAC] Rule monitoring: Event Log for Rule Registry (#98353) 2021-05-27 18:28:19 +03:00
runtime_fields
saved_objects_tagging Add description as title on tag badge (#97109) 2021-04-18 20:49:35 +02:00
searchprofiler
security [telemetry] report config deprecations (#99887) 2021-05-26 10:57:01 +02:00
security_solution [Security Solution][Endpoint][Host Isolation] User can unisolate host from alert details (#100401) 2021-05-27 09:32:32 -04:00
snapshot_restore [Snapshot and Restore] Remove box shadow from panels (#98292) 2021-04-30 12:30:36 -04:00
spaces Fix spaces test flakyness (#100605) 2021-05-26 06:47:28 -04:00
stack_alerts [Alerting] Passing additional rule fields to rule executor (#99819) 2021-05-24 10:25:52 -04:00
task_manager [telemetry] report config deprecations (#99887) 2021-05-26 10:57:01 +02:00
telemetry_collection_xpack Add remaining descriptions to security usage telemetry schema. (#100454) 2021-05-24 10:41:19 -06:00
timelines [plugin-generator] don't generate .eslintrc.js files for internal plugins (#96921) 2021-04-13 07:43:03 -07:00
transform [ML] Transforms: Fix handling of fields with keyword mapping available (#98882) 2021-05-04 16:21:27 +02:00
translations [Logs UI] Add shared observability page template and navigation (#99380) 2021-05-27 16:58:15 +02:00
triggers_actions_ui [triggersActionsUi] Reduce page load bundle to under 100kB (#97770) 2021-05-25 19:00:29 -07:00
ui_actions_enhanced Enable custom time ranges for saved searches (#99180) 2021-05-05 16:35:39 +02:00
upgrade_assistant [Upgrade Assistant] Address copy feedback (#99632) 2021-05-25 14:14:08 -04:00
uptime [Uptime] Waterfall use different styling for number (#97216) 2021-05-27 17:01:52 +02:00
watcher Rename client integration test folders (#100119) 2021-05-20 08:54:47 -04:00
xpack_legacy Remove legacy ES client usages in home and xpack_legacy (#97359) 2021-04-18 20:42:07 +02:00