We strongly recommend only using
cockroach debug job-trace when working directly with the Cockroach Labs support team.cockroach debug job-trace command connects to your cluster and collects trace payloads for a running, traceable job (imports or backups). The trace payloads are helpful for debugging why a job is not running as expected or to add more context to logs gathered from the cockroach debug zip command.
The node that cockroach debug job-trace is run against will communicate to all nodes in the cluster in order to retrieve the trace payloads. This will deliver a zip file that contains trace files for all the nodes participating in the execution of the job. The files hold information on the executing job’s trace spans, which describe the sub-operations being performed. Specifically, these files will contain the spans that have not yet completed and are associated with the execution of that particular job. Using this command for a job that is not currently running will result in an empty zip file.
Synopsis
SHOW JOBS for details on capturing a job_id.
Subcommands
While thecockroach debug command has a few subcommands, users are expected to use only the zip, encryption-active-key, merge-logs, list-files, tsdump, and ballast subcommands.
We recommend using the encryption-decrypt and job-trace subcommands only when directed by the Cockroach Labs support team.
The other debug subcommands are useful only to Cockroach Labs. Output of debug commands may contain sensitive or secret information.
Flags
Thedebug job-trace subcommand supports the following general-use and client connection flags.
General
Client connection
Files
Thecockroach debug job-trace command will output a zip file to where the command is run (<job_id-job-trace.zip). The zip file will contain trace files for all the nodes participating in the job’s execution. For example, node1-trace.txt.
See the SHOW TRACE FOR SESSION page for more information on trace responses.
Example
Generate a job-trace zip file
To generate thejob-trace zip file, use your connection string to pull the trace spans:

