2020-08-11 19:39:44 +00:00
|
|
|
---
|
|
|
|
layout: docs
|
|
|
|
page_title: 'Commands: operator debug'
|
|
|
|
sidebar_title: debug
|
|
|
|
description: |
|
|
|
|
Build an archive of debug data.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Command: operator debug
|
|
|
|
|
|
|
|
The `operator debug` command builds an archive containing Nomad cluster
|
|
|
|
configuration and state information, Nomad server and client node
|
|
|
|
logs, and pprof profiles from the selected servers and client nodes.
|
|
|
|
|
|
|
|
If no selection option is specified, the debug archive contains only
|
|
|
|
cluster meta information.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```plaintext
|
|
|
|
nomad operator debug [options]
|
|
|
|
```
|
|
|
|
|
|
|
|
This command accepts comma separated `server-id` and `node-id` IDs for
|
|
|
|
monitoring and pprof profiling. If IDs are provided, the command will
|
|
|
|
monitor logs for the `duration`, saving a snapshot of Nomad state
|
|
|
|
every `interval`. Captured logs and configurations are subjected to
|
|
|
|
redaction, but may still contain sensitive information and the archive
|
|
|
|
contents should be reviewed before sharing.
|
|
|
|
|
|
|
|
If an `output` path is provided, `debug` will create a timestamped
|
|
|
|
directory in that path instead of an archive. By default, the command
|
|
|
|
creates a compressed tar archive in the current directory.
|
|
|
|
|
|
|
|
Consul and Vault status and version information are included if
|
|
|
|
configured.
|
|
|
|
|
2020-11-19 21:38:08 +00:00
|
|
|
If ACLs are enabled, this command will require a token with the 'node:read'
|
|
|
|
capability to run. In order to collect information, the token will also
|
|
|
|
require the 'agent:read' and 'operator:read' capabilities, as well as the
|
|
|
|
'list-jobs' capability for all namespaces.
|
|
|
|
|
2020-08-11 19:39:44 +00:00
|
|
|
## General Options
|
|
|
|
|
2020-11-19 18:02:48 +00:00
|
|
|
@include 'general_options_no_namespace.mdx'
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
## Debug Options
|
|
|
|
|
|
|
|
- `-duration=2m`: Set the duration of the log monitor command.
|
|
|
|
Defaults to `"2m"`. Logs will be captured from specified servers and
|
|
|
|
nodes at `log-level`.
|
|
|
|
|
|
|
|
- `-interval=2m`: The interval between snapshots of the Nomad state.
|
2020-09-30 13:48:40 +00:00
|
|
|
If unspecified, only one snapshot is captured.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-log-level=DEBUG`: The log level to monitor. Defaults to `DEBUG`.
|
|
|
|
|
|
|
|
- `-node-id=n1,n2`: Comma separated list of Nomad client node ids, to
|
2020-09-30 13:48:40 +00:00
|
|
|
monitor for logs and include pprof data. Accepts id prefixes.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-server-id=s1,s2`: Comma separated list of Nomad server names, or
|
2020-09-30 13:48:40 +00:00
|
|
|
the special server name "leader" to monitor for logs and include
|
|
|
|
pprof data.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-output=path`: Path to the parent directory of the output
|
2020-09-30 13:48:40 +00:00
|
|
|
directory. Defaults to the current directory. If specified, no
|
|
|
|
archive is built.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-consul-http-addr=<addr>`: The address and port of the Consul HTTP
|
|
|
|
agent. Overrides the `CONSUL_HTTP_ADDR` environment variable.
|
|
|
|
|
|
|
|
- `-consul-token=<token>`: Token used to query Consul. Overrides the
|
2020-09-30 13:48:40 +00:00
|
|
|
`CONSUL_HTTP_TOKEN` environment variable and the Consul token
|
|
|
|
file.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-consul-token-file=<path>`: Path to the Consul token file. Overrides the `CONSUL_HTTP_TOKEN_FILE`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-consul-client-cert=<path>`: Path to the Consul client cert file. Overrides the `CONSUL_CLIENT_CERT`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-consul-client-key=<path>`: Path to the Consul client key file. Overrides the `CONSUL_CLIENT_KEY`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-consul-ca-cert=<path>`: Path to a CA file to use with Consul. Overrides the `CONSUL_CACERT`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable and the Consul CA path.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-consul-ca-path=<path>`: Path to a directory of PEM encoded CA cert files to verify the Consul
|
2020-09-30 13:48:40 +00:00
|
|
|
certificate. Overrides the `CONSUL_CAPATH` environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-vault-address=<addr>`: The address and port of the Vault HTTP agent. Overrides the `VAULT_ADDR`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-vault-token=<token>`: Token used to query Vault. Overrides the `VAULT_TOKEN` environment
|
2020-09-30 13:48:40 +00:00
|
|
|
variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-vault-client-cert=<path>`: Path to the Vault client cert file. Overrides the `VAULT_CLIENT_CERT`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-vault-client-key=<path>`: Path to the Vault client key file. Overrides the `VAULT_CLIENT_KEY`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-vault-ca-cert=<path>`: Path to a CA file to use with Vault. Overrides the `VAULT_CACERT`
|
2020-09-30 13:48:40 +00:00
|
|
|
environment variable and the Vault CA path.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
- `-vault-ca-path=<path>`: Path to a directory of PEM encoded CA cert files to verify the Vault
|
2020-09-30 13:48:40 +00:00
|
|
|
certificate. Overrides the `VAULT_CAPATH` environment variable.
|
2020-08-11 19:39:44 +00:00
|
|
|
|
|
|
|
## Output
|
|
|
|
|
|
|
|
This command prints the name of the timestamped archive file produced.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```shell-session
|
|
|
|
$ nomad operator debug -duration 20s -interval 5s -server-id leader -node-id 6e,dd
|
|
|
|
Starting debugger and capturing cluster data...
|
|
|
|
Interval: '5s'
|
|
|
|
Duration: '20s'
|
|
|
|
Capture interval 0000
|
|
|
|
Capture interval 0001
|
|
|
|
Capture interval 0002
|
|
|
|
Capture interval 0003
|
|
|
|
Created debug archive: nomad-debug-2020-07-20-205223Z.tar.gz
|
|
|
|
```
|