Event Filter Plugin
What the Event Filter plugin does
The Event Filter plugin extends Echo and has the following features:
- Skip sending an event that Echo normally sends to external log aggregators
- Trim the event before sending it to the log aggregators
The trim and skip functionality uses JSON Path specification syntax.
The default action is to skip the event if the specified condition matches. To do a trim, you have to configure the trim action (action: TRIM
).
Installing the plugin consists of the following:
- Decide what you want to filter or trim
- Install in your Spinnaker instance:
Compatiblity matrix
Armory CD Version | Spinnaker Version | Event Filter Plugin Version |
---|---|---|
2.32.x | 1.32.x | 0.1.1 |
2.30.x | 1.30.x | 0.0.5 |
- | 1.29.x | 0.0.5 |
Before you begin
You should be familiar with the the Event types section of Spinnaker’s Notifications and Events Guide. That section shows you the structure of an example event and defines details.type
, details.application
, and content.execution
.
Show an example event
{
"details": {
"source": "orca",
"type": "orca:task:complete",
"created": "1422487582294",
"organization": null,
"project": null,
"application": "asgard",
"_content_id": null
},
"content": {
"standalone": true,
"context": {
"asgName": "asgard-staging-v048",
"credentials": "test",
"deploy.account.name": "test",
"deploy.server.groups": {},
"kato.last.task.id": {
"id": "19351"
},
"kato.task.id": {
"id": "19351"
},
"kato.tasks": [
{
"history": [
],
"id": "19351",
"resultObjects": []
}
],
"notification.type": "enableasg",
"regions": ["us-west-1"],
"targetop.asg.enableAsg.name": "asgard-staging-v048",
"targetop.asg.enableAsg.regions": ["us-west-1"],
"user": "clin@netflix.com",
"zones": ["us-west-1a", "us-west-1c"]
},
"execution": ...
"executionId": "62ca5574-0629-419a-b9ac-fb873aa165b2",
"taskName": "f92239a7-b57a-408d-9d72-3a77484e050b.enableAsg.monitorAsg.9568e7e5-3c37-4699-9e93-f62118adc7c6"
}
}
Decide what you want to filter
Before you install the plugin, you should decide what events you want to filter or trim. You configure these filters as part of the installation process.
Skip event
The default behavior is to skip sending any event that matches the configured path
and pathValue
.
For example, if you want to skip the event orca:pipeline:complete
, you need to define the JSON path and the value for that path. In this configuration, when an event has a details.type
field with the value orca:pipeline:complete
, Echo does not send the event to the log aggregator.
event:
filters:
- path: details.type
pathValue: orca:pipeline:complete
Trim event
When you define a path
and add action: TRIM
, the Event Filter plugin removes that entry from the event before sending the event to the log aggregator.
In this example, the plugin trims the context.execution
entry from all events where the field is available. However, Echo still sends the event to the log aggregator.
event:
filters:
- path: content.execution
action: TRIM
The trim feature supports advanced configuration with a predicate. In this example, the event filter plugin removes the content.execution
field from the events that have the details.type
equal to orca:pipeline:starting
.
event:
filters:
- path: content.execution
predicate: $.details[?(@.type=='orca:pipeline:starting')]
action: TRIM
Install - Spinnaker Operator
Add a Kustomize patch with the following contents:
spec:
spinnakerConfig:
profiles:
echo:
spinnaker:
extensibility:
plugins:
Armory.EventFilter:
enabled: true
version: <version>
repositories:
eventfilter:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
event:
filters:
- <your-filters>
- Replace
<version>
with the plugin version that’s compatible with your Spinnaker version. - Add your list of filters.
- Add the patch to the
patchesStrategicMerge
section of your kustomization file. - Apply your update.
Show an example with filters
spec:
spinnakerConfig:
profiles:
echo:
spinnaker:
extensibility:
plugins:
Armory.EventFilter:
enabled: true
version: 0.0.2
repositories:
eventfilter:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
event:
filters:
- path: details.type
pathValue: manual
- path: details.type
pathValue: orca:pipeline:complete
- path: content.standalone
action: TRIM
- path: content.execution
predicate: $.details[?(@.type=='orca:pipeline:starting')]
action: TRIM
Alternately, add the plugin configuration in the spec.spinnakerConfig.profiles.echo
section of your spinnakerservice.yml
and then apply your update.
Install - Halyard
A note about installing plugins in Spinnaker
When Halyard adds a plugin to a Spinnaker installation, it adds the plugin repository information to all services, not just the ones the plugin is for. This means that when you restart Spinnaker, each service restarts, downloads the plugin, and checks if an extension exists for that service. Each service restarting is not ideal for large Spinnaker installations due to service restart times. To avoid every Spinnaker service restarting and downloading the plugin, do not add the plugin using Halyard.The Event Filter Plugin extends Echo. You should create or update the extended service’s local profile in the same directory as the other Halyard configuration files. This is usually ~/.hal/default/profiles
on the machine where Halyard is running.
Add the following to your echo-local.yml
file:
spinnaker:
extensibility:
plugins:
Armory.EventFilter:
enabled: true
version: <version>
repositories:
eventfilter:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
event:
filters:
<your-filters>
- Replace
<version>
with the plugin version that’s compatible with your Spinnaker version. - Add your list of filters.
hal deploy apply
your update.
Show an example with filters
spinnaker:
extensibility:
plugins:
Armory.EventFilter:
enabled: true
version: 0.0.2
repositories:
eventfilter:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
event:
filters:
- path: details.type
pathValue: manual
- path: details.type
pathValue: orca:pipeline:complete
- path: content.standalone
action: TRIM
- path: content.execution
predicate: $.details[?(@.type=='orca:pipeline:starting')]
action: TRIM
Release notes
- 0.1.1: Performance improvements on event filtering
- 0.1.0: 1.32 compatible version
- 0.0.5: Performance improvements on event filtering
- 0.0.4: Added Jinja template support
- 0.0.2: 1.30 compatible version
- 0.0.1: Initial release
Feedback
Was this page helpful?
Thank you for letting us know!
Sorry to hear that. Please tell us how we can improve.
Last modified April 25, 2024: (8d6b7367)