# tdCaptureMode
Allows users to specify a custom command to be executed for capturing or locating a thread dump file, enabling users to dynamically determine or generate a thread dump file path during the capture process.
The command should output a valid file path, which will be used for thread dump capture.
How it works internally?
- Executed only when tdPath is not explicitly provided.
- The yc-360 script runs the command via
/bin/sh -c, injectingpidas an environment variable. - The script’s output (stdout) must return a valid thread dump file path
- The returned path is used for thread dump collection.
Type: string
Default: ""
Example (YAML):
Run jstack to generate thread dump data and echo the file path:
options:
tdCaptureMode: "jstack $pid > /tmp/thread_$pid.txt && echo /tmp/thread_$pid.txt"
1
2
2
Run inside a Docker container and locate a thread dump file:
options:
tdCaptureMode: "docker exec $(docker ps -q --filter label=app.pid=$pid) jstack $pid > /logs/thread_$pid.txt && echo /logs/thread_$pid.txt"
1
2
2
Example (CLI):
Run jstack to generate thread dump data and echo the file path:
./yc -tdCaptureMode "jstack $pid > /tmp/thread_$pid.txt && echo /tmp/thread_$pid.txt"
1
Run inside a Docker container and locate a thread dump file:
./yc -tdCaptureCmd "docker exec $(docker ps -q --filter label=app.pid=$pid) jstack $pid > /logs/thread_$pid.txt && echo /logs/thread_$pid.txt"
1