You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`--filter`|`FILTER`|`""`| Filter events. Uses the same filters as `docker events` (see [here](https://docs.docker.com/engine/reference/commandline/events/#filter)) |
104
+
|`--exclude`|`EXCLUDE`|`""`| Exclude events from being reported |
103
105
|`--loglevel`|`LOG_LEVEL`|`"info"`| Use `debug` for more verbose logging |
104
106
|`--servertag`|`SERVER_TAG`|`""`| Prefix to include in the title of notifications. Useful when running docker-event-monitors on multiple machines |
107
+
108
+
### Filter and exclude events
109
+
110
+
Docker Event Monitor offers two options that sound alike, but aren't: `Filter` and `Exclude`.
111
+
By default, the docker system event stream will contain **all** events. The `filter` option is a docker built-in function that allows filtering certain events from the stream. It's a **positive** filter only, meaning it defines which events will pass the filter. The possible filters and syntax are described [here](https://docs.docker.com/engine/reference/commandline/events/#filter).
112
+
113
+
However, docker has no native support for **negative** filter (let all events pass, except those defined) - so I added it. To distingush it from postive filters, this option is named `exclude`.
114
+
Based on how it is implemented, **exclusion happens after filtering**. Together you can create configurations like filtering events of type container, but exclude reporting for a specific container or certain actions.
115
+
116
+
The syntax for exclusion is also `key=value`. But as the exclusion happens on the data contained in the reported event, the `key`s are different from those used for `filtering`. E.g. instead of `event`, `Action` is used. To figure out which keys to use, it's best to enable debug logging and carefully inspect the event's data structure. A typical container event looks like
Delay time.Duration`arg:"env:DELAY" default:"500ms" help:"Delay before next message is send"`
43
45
FilterStrings []string`arg:"env:FILTER,--filter,separate" help:"Filter docker events using Docker syntax."`
44
46
Filtermap[string][]string`arg:"-"`
47
+
ExcludeStrings []string`arg:"env:EXCLUDE,--exclude,separate" help:"Exclude docker events using Docker syntax."`
48
+
Excludemap[string][]string`arg:"-"`
45
49
LogLevelstring`arg:"env:LOG_LEVEL" default:"info" help:"Set log level. Use debug for more logging."`
46
50
ServerTagstring`arg:"env:SERVER_TAG" help:"Prefix to include in the title of notifications. Useful when running docker-event-monitors on multiple machines."`
47
51
Versionbool`arg:"-v" help:"Print version information."`
startup_message_builder.WriteString("Notify via Pushover, using API Token "+glb_arguments.PushoverAPIToken+" and user key "+glb_arguments.PushoverUserKey)
0 commit comments