Jenkins: Logfile location on slave nodes? Jenkins: Logfile location on slave nodes? jenkins jenkins

Jenkins: Logfile location on slave nodes?


Jenkins stores all logs on master only, that's why you cannot find any log on nodes.


On Windows, the slave stores error logs in the same folder as the slave.jar file.This reports things like:

Dec 19, 2018 2:38:14 PM hudson.remoting.Engine waitForServerToBack

"INFO: Failed to connect to the master. Will retry again".

That message will never appear be uploaded to Master.

I would like to see a similar log file on other slaves.


They are mostly transferred to Master by TCP.For example, when a step starts, like a shell task, will do like this

  1. call your shell content
# your script will be transform into a script filescript.sh > jenkins-log.txt# running...# after runningecho $? > jenkins-result.txt
  1. during the running progress, data will be transport by TCP(pull or push)
jenkins-log.txt -> Filestream -> RemoteStream -> Master

and in master, you will see single log like it

jobs/xxx/branch/master/<id>/log
  1. When job is done, master will send the command to clean the temp dir in the agent, so you can't see anything about logs.

One more thing, in our company, we are facing the problem of too much logs are being sent to Master like a DDOS, so a simple way to solve is to add a pipeline after the shell

limit by tail

xxx | tail -c 512k 

or limit the size by head command

xxx | (head -n 1000;dd status=none of=/dev/null)