Google News
logo
Java Jenkins - Interview Questions
How to download the Console log for a particular Jenkins build programmatically?
Using the Jenkins CLI - console - command
 
java -jar jenkins-cli.jar console JOB [BUILD] [-f] [-n N]
 
Produces the console output of a specific build to stdout, as if you are doing 'cat build.log'
 
* JOB : Name of the job
* BUILD : Build number or permalink to point to the build. Defaults to the last build
* -f : If the build is in progress, append console output as it comes, like tail -f
* -n N : Display the last N lines.

Ex :
 
ssh -l <ssh_username> -p <port_no> <Jenkins_URL> console <JOB_NAME>

Advertisement