Skip to main content
The cockroach debug zip connects to your cluster and gathers information from each active node into a single .zip file (inactive nodes are not included). For details on the .zip contents, see Files. You can use the command in conjunction with cockroach debug zip to merge the collected logs into one file, making them easier to parse.
The files produced by cockroach debug zip can contain highly , such as usernames, hashed passwords, and possibly table data. Use the --redact flag to configure CockroachDB to redact sensitive data when generating the .zip file (excluding range keys) if intending to share it with Cockroach Labs.

Details

Use cases

cockroach debug zip is an expensive operation and impacts cluster performance.Only use this command as an emergency measure under the guidance of Cockroach Labs.Particularly fetching stack traces for all goroutines is a “stop-the-world” operation, which can momentarily but significantly increase SQL service latency. Exclude these goroutine stacks by using the --include-goroutine-stacks=false flag.
There are two scenarios in which debug zip is useful:
  • If you experience severe or difficult-to-reproduce issues with your cluster, Cockroach Labs might ask you to send us your cluster’s debugging information using cockroach debug zip. We recommend reducing the *.zip file size by only retrieving debugging information for the relevant time range of the issue by using the --files-from, and/or --files-until flags.
  • To collect all of your nodes’ logs, which you can then parse to locate issues. You can optionally use the flags to retrieve only the log files. For more information about logs, see . Also note:
    • Nodes that are currently cannot deliver their logs over the network. For these nodes, you must log on to the machine where the cockroach process would otherwise be running, and gather the files manually.
    • Nodes that are currently up but disconnected from other nodes (e.g., because of a ) may not be able to respond to debug zip requests forwarded by other nodes, but can still respond to requests for data when asked directly. In such situations, we recommend using the --host flag to point debug zip at each of the disconnected nodes until data has been gathered for the entire cluster.

Files

cockroach debug zip collects log files, heap profiles, CPU profiles, and goroutine dumps from the last 48 hours, by default.
These files can greatly increase the size of the cockroach debug zip output. To limit the .zip file size for a large cluster, we recommend first experimenting with and then using flags to filter the files.
The following files collected by cockroach debug zip, which are found in the individual node directories, can be filtered using the --exclude-files, --include-files, --files-from, and/or --files-until flags: The following information is also contained in the .zip file, and cannot be filtered:
  • System tables. The following system tables are not included:
    • system.users
    • system.web_sessions
    • system.join_tokens
    • system.comments
    • system.ui
    • system.zones
    • system.statement_bundle_chunks
    • system.statement_statistics
    • system.transaction_statistics
  • Cluster events
  • Database details
  • Schema change events
  • Database, table, node, and range lists
  • Node details
  • Node liveness
  • Gossip data
  • Stack traces
  • Range details
  • Jobs
  • CPU profiles
  • A script ( hot-ranges.sh ) that summarizes the hottest ranges (ranges receiving a high number of reads or writes)

Subcommands

While the cockroach debug command has a few subcommands, users are expected to use only the , , , , , and subcommands. We recommend using the and subcommands only when directed by the . The other debug subcommands are useful only to Cockroach Labs. Output of debug commands may contain sensitive or secret information.

Synopsis

The following flags must apply to an active CockroachDB node. If no nodes are live, you must .

Flags

The debug zip subcommand supports the following general-use, client connection, and logging flags.

General

Client connection

Logging

By default, this command logs messages to stderr. This includes events with WARNING and higher. If you need to troubleshoot this command’s behavior, you can .

Examples

Generate a debug zip file

Generate the debug zip file for an insecure cluster:
Generate the debug zip file for a secure cluster:
Secure examples assume you have the appropriate certificates in the default certificate directory, ${HOME}/.cockroach-certs/.

Generate a debug zip file for a time range

Generate a debug zip file containing only debugging information for a specified time range:

Generate a debug zip file with logs only

Generate a debug zip file containing only log files:

Redact sensitive information

Log redaction

Example of a log string without --redact enabled:
Enable log redaction:

Cluster settings redaction

Example cluster settings in crdb_internal.cluster_settings.txt without --redact enabled:
server.identity_map.configuration is always redacted, since sensitive equals true. Enable log redaction:
Cluster settings in crdb_internal.cluster_settings.txt with --redact enabled:
server.identity_map.configuration is still redacted. cluster.organization is now redacted since reportable equals false and the Cockroach Labs Testing value is not the default value (in this case, the empty string).

Hostname and IP address redaction

Example of status.json without hostname and IP address redaction enabled:
Enable hostname and IP address redaction with the cluster setting:
Some hostnames and IP addresses in the nodes.json and gossip.json files are never redacted, even when debug.zip.redact_addresses.enabled is enabled. Generate .zip with --redact enabled:
status.json with hostname and IP address redaction:

See also