Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins "Console Output" log location in filesystem

Tags:

jenkins

I want to access and grep Jenkins Console Output as a post build step in the same job that creates this output. Redirecting logs with >> log.txt is not a solution since this is not supported by my build steps.

Build:

echo "This is log" 

Post build step:

grep "is" path/to/console_output 

Where is the specific log file created in filesystem?

like image 479
Sayid Avatar asked May 23 '16 08:05

Sayid


People also ask

Where is Jenkins console output stored?

Log files should be at /var/log/jenkins/jenkins.

How can we get the Jenkins console output in a text file?

In order to read the console output in Jenkins, All you need to do is copy and paste the code as a stage in your pipeline script. After the build is run, a file named buildConsolelog. txt will be stored in the home directory of your project.

How do I monitor Jenkins logs?

If you want to want to monitor all the Jenkins instances, then you need to install filebeat in all the instances and ships the application log to logstash. Here, we will ship the application logs of one Jenkins instance only. Below is the filebeat. yml to monitor jenkins log file.


1 Answers

@Bruno Lavit has a great answer, but if you want you can just access the log and download it as txt file to your workspace from the job's URL:

${BUILD_URL}/consoleText 

Then it's only a matter of downloading this page to your ${Workspace}

  • You can use "Invoke ANT" and use the GET target
  • On Linux you can use wget to download it to your workspace
  • etc.

Good luck!

Edit: The actual log file on the file system is not on the slave, but kept in the Master machine. You can find it under: $JENKINS_HOME/jobs/$JOB_NAME/builds/lastSuccessfulBuild/log

If you're looking for another build just replace lastSuccessfulBuild with the build you're looking for.

like image 88
Dvir669 Avatar answered Sep 24 '22 06:09

Dvir669