open-consul/website/pages/commands/watch.mdx
Jasmine W 8ae3332165
docs: update structure (#8506)
- moved and renamed files/folders based on new structure
- updated docs navigation based on new structure
- moved CLI to top nav (created commands.jsx and commands-navigation.js)
- updated and added redirects
- updating to be consistent with standalone categories
- changing "overview" link in top nav to lead to where intro was moved (docs/intro)
- adding redirects for intro content
- deleting old intro folders
- format all data/navigation files
- deleting old commands folder
- reverting changes to glossary page
- adjust intro navigation for removal of 'vs' paths
- add helm page redirect
- fix more redirects
- add a missing redirect
- fix broken anchor links and formatting mistakes
- deleted duplicate section, added redirect, changed link
- removed duplicate glossary page
2020-09-01 11:14:13 -04:00

62 lines
2 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Watch'
sidebar_title: watch
description: >-
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](/docs/agent/watches).
## 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](/docs/agent/watches).
#### API Options
@include 'http_api_options_client.mdx'
@include 'http_api_options_server.mdx'
#### Command Options
- `-key` - Key to watch. Only for `key` type.
- `-name`- Event name to watch. Only for `event` type.
- `-passingonly=[true|false]` - Should only passing entries be returned. Defaults to
`false` and only applies for `service` type.
- `-prefix` - Key prefix to watch. Only for `keyprefix` type.
- `-service` - Service to watch. Required for `service` type, optional for `checks` type.
- `-shell` - Optional, use a shell to run the command (can set a custom shell via the
SHELL environment variable). The default value is true.
- `-state` - Check state to filter on. Optional for `checks` type.
- `-tag` - Service tag to filter on. Optional for `service` type.
- `-type` - Watch type. Required, one of "`key`, `keyprefix`, `services`,
`nodes`, `service`, `checks`, or `event`.