events command to get a real-time display of
events generated by Vault and subscribe to Vault
events. Note that the
events subscribe runs indefinitly and will not exit on
its own unless it encounters an unexpected error. Similar to
tail -f in the
Unix world, you must terminate the process from the command line to end the
Specify the desired event types (also called "topics") as a glob pattern. To
match against multiple events, use
* as a wildcard. The command returns
serialized JSON objects in the default protobuf JSON serialization format with
one line per event received.
Subscribe to all events:
$ vault events subscribe '*'
Subscribe to all KV events:
$ vault events subscribe 'kv*'
Subscribe to all
$ vault events subscribe kv-v2/data-write
Subscribe to all KV events in the current and
ns1 namespaces for the secret
secret/data/foo that do not involve writing data:
$ vault events subscribe -namespaces=ns1 -filter='data_path == secret/data/foo and operation != "data-write"' 'kv*'
events subscribe supports the following flags in addition to the standard set of
flags included on all commands.
(duration: "")- close the WebSocket automatically after the specified duration.
(string: "")- Filter expression used to select events to be sent through the WebSocket.
Refer to the Filter expressions guide in the Boundary documentation for a complete list of filtering options and an explanation on how we evaluate filter expressions.
The following values are available in the filter expression:
event_type: the event type, e.g.,
operation: the operation name that caused the event, e.g.,
source_plugin_mount: the mount of the plugin that produced the event, e.g.,
data_path: the API path that can be used to access the data of the secret related to the event, e.g.,
namespace: the path of the namespace that created the event, e.g.,
The filter string is empty by default. Unfiltered subscription requests match to all events that the requestor has access to for the target event type. When the filter string is not empty, Vault applies the filter conditions after the policy checks to narrow the events provided in the response.
Filters can be straightforward path matches like
data_path == secret/data/foo, which specifies that Vault should pass return events that refer to the
secret/data/foosecret to the WebSocket. Or more complex statements that exclude specific operations. For example:
data_path == secret/data/foo and operation != write
This feature requires Vault Enterprise(opens in new tab).
(string)- Additional child namespaces for the subscription. Repeat the flag to add additional namespace patterns to the subscription request. Vault automatically prepends the issuing namespace for the request to the provided namespace. For example, if you include
-namespaces=ns2on a request made in the
ns1namespace, Vault will attempt to subscribe you to events under the
ns1namespaces. You can use the
*character to include wildcards in the namespace pattern. By default, Vault will only subscribe to events in the requesting namespace.
NoteTo subscribe to events across multiple namespaces, you must provide a root token or a token associated with appropriate policies across all the targeted namespaces. Refer to the Secure multi-tenancy with namespacestutorial for configuring your Vault instance appropriately.