* `-duration` - Optional, the total time to capture data for from the target agent. Must
be greater than the interval and longer than 10 seconds. Defaults to 2 minutes.
* `-interval` - Optional, the interval at which to capture dynamic data, such as logs
and metrics. Must be longer than 5 seconds. Defaults to 30 seconds.
* `-capture` - Optional, can be specified multiple times for each [capture target](#capture-targets)
and will only record that information in the archive.
* `-output` - Optional, the full path of where to write the directory of data and
resulting archive. Defaults to the current directory.
* `-archive` - Optional, if the tool show archive the directory of data into a
compressed tar file. Defaults to true.
## Capture Targets
The `-capture` flag can be specified multiple times to capture specific
information when `debug` is running. By default, it captures all information.
| Target | Description |
| ------ | ---------------------------- |
| `agent` | Version and configuration information about the agent. |
| `host` | Information about resources on the host running the target agent such as CPU, memory, and disk. |
| `cluster` | A list of all the WAN and LAN members in the cluster. |
| `metrics` | Metrics from the in-memory metrics endpoint in the target, captured at the interval. |
| `logs` | `DEBUG` level logs for the target agent, captured for the interval. |
| `pprof` | Golang heap, CPU, goroutine, and trace profiling. This information is not retrieved unless [`enable_debug`](/docs/agent/options.html#enable_debug) is set to `true` on the target agent. |
## Examples
This command can be run from any host with the Consul binary, but requires
network access to the target agent in order to retrieve data. Once retrieved,
the data is written to the the specified path (defaulting to the current
directory) on the host where the command runs.
By default the command will capture all available data from the default
agent address on loopback for 2 minutes at 30 second intervals.
```text
$ consul debug
...
```
In this example, the archive is collected from a different agent on the
network using the standard Consul CLI flag to change the API address.
```text
$ consul debug -http-addr=10.0.1.10:8500
...
```
The capture flag can be specified to only record a subset of data
about the agent and environment.
```text
$ consul debug -capture agent -capture host -capture logs
...
```
The duration of the command and interval of capturing dynamic
information (such as metrics) can be specified with the `-interval`