-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[RAC][Rule Registry] Improve the API of RuleDataService and RuleDataClient #106421
Closed
5 of 6 tasks
Tracked by
#101016
Labels
Team:Detection Alerts
Security Detection Alerts Area Team
Team:Detections and Resp
Security Detection Response Team
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Theme: rac
label obsolete
Comments
41 tasks
banderror
added
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Team:Detections and Resp
Security Detection Response Team
Theme: rac
label obsolete
and removed
needs-team
Issues missing a team label
labels
Jul 21, 2021
Pinging @elastic/security-solution (Team: SecuritySolution) |
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Merged
17 tasks
banderror
added a commit
that referenced
this issue
Aug 15, 2021
…ing implementation (#108115) **Addresses:** #106421, #106428, #102089, #106433 ## Summary This PR focuses on consolidation of indexing implementations in `rule_registry` (#101016). It addresses some of the sub-tasks of the parent ticket. - [x] Encapsulate index bootstrapping logic in a new improved API exposed by `RuleDataService`. - [x] Enforce allowed values for the `datasetSuffix` on the API level. - [x] Migrate plugins using the existing `RuleDataService` API to the improved one. - [x] Make sure index names comply with design architecture. - #102089 - [x] Improve the API of `RuleDataClient`. - [x] Enhance index bootstrapping: support custom ILM policy per index (`{registrationContext}.{datasetSuffix}`). - [x] Enhance index bootstrapping: create index template per namespace and support rollovers properly - based on #107700 - [x] Enhance index bootstrapping: support secondary aliases - based on #107700 - [x] Remove `EventLogService` implementation - #106433 This will be addressed in follow-up PRs: - [ ] Enhance index bootstrapping: implement suggestions for backwards compatibility (naming scheme for alias and backing indices; versioning). - [ ] Enhance index bootstrapping: implement upgrades of existing index templates. - [ ] Make index bootstrapping logic more robust. This _is partially addressed_ in this PR, but more improvements are needed. - [ ] Change the way index prefix works. - [ ] Add support for optional TS schema (static typing). - [ ] Update `README` in `rule_registry`. ### Checklist - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this issue
Aug 15, 2021
…ing implementation (elastic#108115) **Addresses:** elastic#106421, elastic#106428, elastic#102089, elastic#106433 ## Summary This PR focuses on consolidation of indexing implementations in `rule_registry` (elastic#101016). It addresses some of the sub-tasks of the parent ticket. - [x] Encapsulate index bootstrapping logic in a new improved API exposed by `RuleDataService`. - [x] Enforce allowed values for the `datasetSuffix` on the API level. - [x] Migrate plugins using the existing `RuleDataService` API to the improved one. - [x] Make sure index names comply with design architecture. - elastic#102089 - [x] Improve the API of `RuleDataClient`. - [x] Enhance index bootstrapping: support custom ILM policy per index (`{registrationContext}.{datasetSuffix}`). - [x] Enhance index bootstrapping: create index template per namespace and support rollovers properly - based on elastic#107700 - [x] Enhance index bootstrapping: support secondary aliases - based on elastic#107700 - [x] Remove `EventLogService` implementation - elastic#106433 This will be addressed in follow-up PRs: - [ ] Enhance index bootstrapping: implement suggestions for backwards compatibility (naming scheme for alias and backing indices; versioning). - [ ] Enhance index bootstrapping: implement upgrades of existing index templates. - [ ] Make index bootstrapping logic more robust. This _is partially addressed_ in this PR, but more improvements are needed. - [ ] Change the way index prefix works. - [ ] Add support for optional TS schema (static typing). - [ ] Update `README` in `rule_registry`. ### Checklist - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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
kibanamachine
added a commit
that referenced
this issue
Aug 15, 2021
…ing implementation (#108115) (#108638) **Addresses:** #106421, #106428, #102089, #106433 ## Summary This PR focuses on consolidation of indexing implementations in `rule_registry` (#101016). It addresses some of the sub-tasks of the parent ticket. - [x] Encapsulate index bootstrapping logic in a new improved API exposed by `RuleDataService`. - [x] Enforce allowed values for the `datasetSuffix` on the API level. - [x] Migrate plugins using the existing `RuleDataService` API to the improved one. - [x] Make sure index names comply with design architecture. - #102089 - [x] Improve the API of `RuleDataClient`. - [x] Enhance index bootstrapping: support custom ILM policy per index (`{registrationContext}.{datasetSuffix}`). - [x] Enhance index bootstrapping: create index template per namespace and support rollovers properly - based on #107700 - [x] Enhance index bootstrapping: support secondary aliases - based on #107700 - [x] Remove `EventLogService` implementation - #106433 This will be addressed in follow-up PRs: - [ ] Enhance index bootstrapping: implement suggestions for backwards compatibility (naming scheme for alias and backing indices; versioning). - [ ] Enhance index bootstrapping: implement upgrades of existing index templates. - [ ] Make index bootstrapping logic more robust. This _is partially addressed_ in this PR, but more improvements are needed. - [ ] Change the way index prefix works. - [ ] Add support for optional TS schema (static typing). - [ ] Update `README` in `rule_registry`. ### Checklist - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 Co-authored-by: Georgii Gorbachev <[email protected]>
Partially addressed in #108115 |
banderror
changed the title
[RAC] Improve the API of RuleDataService and RuleDataClient
[RAC][Rule Registry] Improve the API of RuleDataService and RuleDataClient
Sep 1, 2021
Hey everyone, FYI ownership of this ticket and other tickets related to rule_registry (like #101016) now goes to the Detection Alerts area ( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Team:Detection Alerts
Security Detection Alerts Area Team
Team:Detections and Resp
Security Detection Response Team
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Theme: rac
label obsolete
Parent ticket: #101016
Summary
We'd like to improve DX for those who need to work with RuleDataService and RuleDataClient.
On a high level, if we compare the two implementations we have in rule_registry, and what we'd like to achieve:
any
)FieldMap
Specifically, let's do the following:
Make it simple and declarative to specify TypeScript schema for
RuleDataClient
.FieldMap
to it. This is basically what was already implemented in [RAC] Build a consolidated implementation in Rule Registry (Draft) #101453Make it simple and declarative to specify Elasticsearch resources needed for an instance of
RuleDataClient
(and its corresponding indices, e.g..alerts-security.alerts-{namespace}
): ILM policy, component templates, index template, aliases, etc.getWriter
, a single writer should be used for the duration of a rule executor.getWriter
should not be called repeatedly. We should make this clear in documentation, and also renamegetWriter
to something that sounds more appropriate likeinitializeWriter
- this has a better chance of letting devs know thatinitializeWriter
is not something you want to call repeatedly.Use flexible approach to component templates, but enforce anything that is critical to correct work of this implementation. For example, a solution dev should be able to specify any number of component templates for a log (e.g. 3 custom component templates for
security.alerts
carrying something that makes sense for security detection alerts), but the implementation must include references to the common templates (e.g. with "technical fields") under the hood.Index bootstrapping logic should be encapsulated.
RuleDataService
should provide a method that would implement bootstrapping; it would accept a log definition object and return aRuleDataClient
. Invariants should be enforced by this logic, race conditions and errors handled correctly.Enforce allowed values for the
datasetSuffix
on the API level. In the index naming convention.alerts-{registrationContext}.{datasetSuffix}-{namespace}
,datasetSuffix
can only bealerts
orevents
. It would make sense to restrict it in theRuleDataService
interface to make it safer and more explicit for developers.Provide different default values for
namespace
, which seem a bit safer defaults:getWriter
setnamespace = 'default'
by defaultgetReader
maybe setnamespace = '*'
by defaultDetails
Promise<RuleDataClient>
for that log. Rule executors can thenawait
this promise to ensure that they don't write to the log until it is properly bootstrapped. This removes the need for solution plugins to define a "ready signal" to pass into the RuleDataClient that signals when the templates are created, instead the rule registry handles all the synchronization.RuleDataPluginService.createOrUpdateComponentTemplate
andRuleDataPluginService.createOrUpdateIndexTemplate
. A schema for the log can be passed in as an optional parameter alongside the log definition to get static typing for the documents written by the RuleDataClient writer.RuleDataPluginService.bootstrapSolutionTemplates(templates): Promise<RuleDataClient>
instead of imperatively creating the templates and later directly instantiating a RuleDataClient..alerts
indices. The rule registry may provide other component templates that solutions can share for ease of use, e.g. the full ECS component template.This approach should adopt the declarative style from the event_log. The main difference is it aims to be a lighter-weight implementation that encapsulates template bootstrapping details while providing some flexibility in log definitions. Rather than caching objects for repeated retrieval from the service, the RuleDataPluginService will simply create templates and return a
Promise<RuleDataClient>
. Solution plugins will be responsible for passing the RuleDataClient around to the appropriate places where it is needed.The text was updated successfully, but these errors were encountered: