github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/commands/operator/debug.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Commands: operator debug'
     4  sidebar_title: debug
     5  description: |
     6    Build an archive of debug data.
     7  ---
     8  
     9  # Command: operator debug
    10  
    11  The `operator debug` command builds an archive containing Nomad cluster
    12  configuration and state information, Nomad server and client node
    13  logs, and pprof profiles from the selected servers and client nodes.
    14  
    15  If no selection option is specified, the debug archive contains only
    16  cluster meta information.
    17  
    18  ## Usage
    19  
    20  ```plaintext
    21  nomad operator debug [options]
    22  ```
    23  
    24  This command accepts comma separated `server-id` and `node-id` IDs for
    25  monitoring and pprof profiling. If IDs are provided, the command will
    26  monitor logs for the `duration`, saving a snapshot of Nomad state
    27  every `interval`. Captured logs and configurations are subjected to
    28  redaction, but may still contain sensitive information and the archive
    29  contents should be reviewed before sharing.
    30  
    31  If an `output` path is provided, `debug` will create a timestamped
    32  directory in that path instead of an archive. By default, the command
    33  creates a compressed tar archive in the current directory.
    34  
    35  Consul and Vault status and version information are included if
    36  configured.
    37  
    38  If ACLs are enabled, this command will require a token with the 'node:read'
    39  capability to run. In order to collect information, the token will also
    40  require the 'agent:read' and 'operator:read' capabilities, as well as the
    41  'list-jobs' capability for all namespaces. To collect pprof profiles the
    42  token will also require 'agent:write', or enable_debug configuration set to 
    43  true.
    44  
    45  ## General Options
    46  
    47  @include 'general_options_no_namespace.mdx'
    48  
    49  ## Debug Options
    50  
    51  - `-duration=2m`: Set the duration of the log monitor command.
    52    Defaults to `"2m"`. Logs will be captured from specified servers and
    53    nodes at `log-level`.
    54  
    55  - `-interval=2m`: The interval between snapshots of the Nomad state.
    56    If unspecified, only one snapshot is captured.
    57  
    58  - `-log-level=DEBUG`: The log level to monitor. Defaults to `DEBUG`.
    59  
    60  - `-max-nodes=<count>`: Cap the maximum number of client nodes included 
    61    in the capture.  Defaults to 10, set to 0 for unlimited.
    62  
    63  - `-node-class=<node-class>`: Filter client nodes based on node class.
    64  
    65  - `-node-id=<node1>,<node2>`: Comma separated list of Nomad client node ids,
    66    to monitor for logs and include pprof profiles. Accepts id prefixes, and 
    67    "all" to select all nodes (up to count = max-nodes).
    68  
    69  - `pprof-duration=<duration>`: Duration for pprof collection. Defaults to 1s.
    70  
    71  - `-server-id=s1,s2`: Comma separated list of Nomad server names, "leader", or
    72    "all" to monitor for logs and include pprof profiles.
    73  
    74  - `stale=<true|false>`: If "false", the default, get membership data from the
    75    cluster leader. If the cluster is in an outage unable to establish
    76    leadership, it may be necessary to get the configuration from a non-leader
    77    server.
    78  
    79  - `-output=path`: Path to the parent directory of the output
    80    directory. Defaults to the current directory. If specified, no
    81    archive is built.
    82  
    83  - `-consul-http-addr=<addr>`: The address and port of the Consul HTTP
    84    agent. Overrides the `CONSUL_HTTP_ADDR` environment variable.
    85  
    86  - `-consul-token=<token>`: Token used to query Consul. Overrides the
    87    `CONSUL_HTTP_TOKEN` environment variable and the Consul token
    88    file.
    89  
    90  - `-consul-token-file=<path>`: Path to the Consul token file. Overrides the `CONSUL_HTTP_TOKEN_FILE`
    91    environment variable.
    92  
    93  - `-consul-client-cert=<path>`: Path to the Consul client cert file. Overrides the `CONSUL_CLIENT_CERT`
    94    environment variable.
    95  
    96  - `-consul-client-key=<path>`: Path to the Consul client key file. Overrides the `CONSUL_CLIENT_KEY`
    97    environment variable.
    98  
    99  - `-consul-ca-cert=<path>`: Path to a CA file to use with Consul. Overrides the `CONSUL_CACERT`
   100    environment variable and the Consul CA path.
   101  
   102  - `-consul-ca-path=<path>`: Path to a directory of PEM encoded CA cert files to verify the Consul
   103    certificate. Overrides the `CONSUL_CAPATH` environment variable.
   104  
   105  - `-vault-address=<addr>`: The address and port of the Vault HTTP agent. Overrides the `VAULT_ADDR`
   106    environment variable.
   107  
   108  - `-vault-token=<token>`: Token used to query Vault. Overrides the `VAULT_TOKEN` environment
   109    variable.
   110  
   111  - `-vault-client-cert=<path>`: Path to the Vault client cert file. Overrides the `VAULT_CLIENT_CERT`
   112    environment variable.
   113  
   114  - `-vault-client-key=<path>`: Path to the Vault client key file. Overrides the `VAULT_CLIENT_KEY`
   115    environment variable.
   116  
   117  - `-vault-ca-cert=<path>`: Path to a CA file to use with Vault. Overrides the `VAULT_CACERT`
   118    environment variable and the Vault CA path.
   119  
   120  - `-vault-ca-path=<path>`: Path to a directory of PEM encoded CA cert files to verify the Vault
   121    certificate. Overrides the `VAULT_CAPATH` environment variable.
   122  
   123  ## Output
   124  
   125  This command prints a summary of the capture and the name of the timestamped 
   126  archive file produced.
   127  
   128  ## Examples
   129  
   130  ```shell-session
   131  $ nomad operator debug -duration 5s -interval 5s -server-id all -node-id b5,20
   132  Starting debugger...
   133  
   134            Servers: (3/3) [server1.global server2.global server3.global]
   135            Clients: (2/3) [b547cd3a-085f-68c2-55f4-e99beebb0433 20c0964b-72cc-4083-87fe-ec6905b6230a]
   136           Interval: 5s
   137           Duration: 5s
   138  
   139  Capturing cluster data...
   140      Capture interval 0000
   141      Capture interval 0001
   142      Capture interval 0002
   143      Capture interval 0003
   144  Created debug archive: nomad-debug-2020-12-08-034455Z.tar.gz
   145  ```
   146  
   147  ```shell-session
   148  $ nomad operator debug -duration 5s -interval 5s -server-id all -node-id all -max-nodes=1
   149  Starting debugger...
   150  
   151            Servers: (3/3) [server1.global server2.global server3.global]
   152            Clients: (1/3) [b547cd3a-085f-68c2-55f4-e99beebb0433]
   153                     Max node count reached (1)
   154           Interval: 5s
   155           Duration: 5s
   156  
   157  Capturing cluster data...
   158      Capture interval 0000
   159      Capture interval 0001
   160      Capture interval 0002
   161      Capture interval 0003
   162  Created debug archive: nomad-debug-2020-12-08-034113Z.tar.gz
   163  ```