2.1 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
docs | Commands: Watch | docs-commands-watch | The `watch` command provides a mechanism to watch for changes in a particular data view (list of nodes, service members, key value, etc) and to invoke a process with the latest values of the view. If no process is specified, the current values are dumped to stdout which can be a useful way to inspect data in Consul. |
Consul Watch
Command: consul watch
The watch
command provides a mechanism to watch for changes in a particular
data view (list of nodes, service members, key value, etc) and to invoke
a process with the latest values of the view. If no process is specified,
the current values are dumped to stdout which can be a useful way to inspect
data in Consul.
There is more documentation on watches here.
Usage
Usage: consul watch [options] [child...]
The only required option is -type
which specifies the particular
data view. Depending on the type, various options may be required
or optionally provided. There is more documentation on watch
specifications here.
The list of available flags are:
-
-http-addr
- Address to the HTTP server of the agent you want to contact to send this command. If this isn't specified, the command will contact "127.0.0.1:8500" which is the default HTTP address of a Consul agent. -
-datacenter
- Datacenter to query. Defaults to that of agent. -
-token
- ACL token to use. Defaults to that of agent. -
-key
- Key to watch. Only forkey
type. -
-name
- Event name to watch. Only forevent
type. -
-passingonly=[true|false]
- Should only passing entries be returned. Default false. only forservice
type. -
-prefix
- Key prefix to watch. Only forkeyprefix
type. -
-service
- Service to watch. Required forservice
type, optional forchecks
type. -
-state
- Check state to filter on. Optional forchecks
type. -
-tag
- Service tag to filter on. Optional forservice
type. -
-type
- Watch type. Required, one of "key", "keyprefix", "services", "nodes", "service", "checks", or "event".