Graylog2 / Graylog2/graylog2-server
Improve legacy alert condition / alarm callback support in content packs
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 217
Description
## Description
In https://github.com/Graylog2/graylog2-server/pull/6279 we disabled the legacy alert conditions and alarm callbacks for content pack exports so they will not be included in newly created content packs. When users install an older content pack that includes legacy conditions and callbacks, we still create the legacy objects in the database but immediately run the `LegacyAlertConditionMigrator` to convert them to new event definitions and event notifications.
While this approach works, it has some drawbacks.
1. We write legacy conditions and callbacks to the database
1. The migrated event definitions and notifications are not deleted when the content pack will be uninstalled because they haven't been registered
A better way to do this would be to refactor the `LegacyAlertConditionMigrator` so we can reuse it to convert legacy conditions and callbacks to new event definitions and notifications. Right now the class is pretty specific for the database migration use case.
## Tasks
- [ ] Refactor `LegacyAlertConditionMigrator` to make it reusable for the content pack use case
- [ ] Change content pack code to avoid creating the legacy entities but directly create new event definitions and notifications
Contributor guide
Assessment
This issue has not been assessed yet.