Is the server or the remote agent used for the timestamp of the build log?
Asked by Steve Holzer:

Which host time is used for the timstamp in the build logs?


Answers:
author: Daniel Santos
body: Hi [@Steve Holzer](/t5/user/viewprofilepage/user-id/749490),

This is how Bamboo behaves according to my recent tests (6.6.1).

* Build logs are composed by messages from both server and agent
* The server receives the agent message with agent timestamp and converts to server's timezone and add them to the build log. This means that agents timezones are irrelevant for the build logs but the correct time is important.
* If either server or agent are not synced, you will probably see some strange behavior like the following:

  ```
  simple 17-Dec-2018 15:16:09 Finished task 'SSH Task' with result: Error
  simple 17-Dec-2018 15:16:09 Running post build plugin 'Docker Container Cleanup'
  simple 17-Dec-2018 15:16:09 Running post build plugin 'NCover Results Collector'
  simple 17-Dec-2018 15:16:09 Running post build plugin 'Clover Results Collector'
  simple 17-Dec-2018 15:16:09 Running post build plugin 'npm Cache Cleanup'
  simple 17-Dec-2018 15:16:09 Running post build plugin 'Artifact Copier'
  simple 17-Dec-2018 15:16:09 Finalising the build...
  simple 17-Dec-2018 15:16:09 Stopping timer.
  simple 17-Dec-2018 15:16:09 Build PROJ-PLAN-JOB-17 completed.
  simple 17-Dec-2018 12:22:32 Running on server: post build plugin 'NCover Results Collector'
  simple 17-Dec-2018 12:22:32 Running on server: post build plugin 'Build Hanging Detection Configuration'
  simple 17-Dec-2018 12:22:32 Running on server: post build plugin 'Clover Delta Calculator'
  simple 17-Dec-2018 12:22:32 Running on server: post build plugin 'Maven Dependencies Postprocessor'
  simple 17-Dec-2018 12:22:32 All post build plugins have finished
  simple 17-Dec-2018 12:22:32 Generating build results summary...
  simple 17-Dec-2018 12:22:32 Saving build results to disk...
  simple 17-Dec-2018 12:22:32 Logging substituted variables...
  simple 17-Dec-2018 12:22:32 Indexing build results...
  simple 17-Dec-2018 12:22:32 Finished building PROJ-PLAN-JOB-17.
  ```

  (i) In this case the agent time was configured to \~3h in the future (the time was completely off). Agents messages are the first ones.

I hope that clarifies how Bamboo deal with build log timestamps.

comments: author: Steve Holzer
body: Hello Daniel and Happy New Year for you.

Thanks for the input on the question. It does raise another question.

How to determine server from agent messages in the log.

Some of your example log entries are easy enough to identify as server but how to do this for the whole log?


author: Daniel Santos
body: Hi Steve,

I don't see an easy way to do this. I think that If I had to do that I would probably run a diff between the build log file and the agent build logs at *\<Bamboo_Agent\>/temp/log_spool/\<Plan_Storage_Tag\>-\<Job_Name\>-\<Build_Number\>.log.
e.g. "Agent_6.7.2/temp/log_spool/plan-9273349-JOB-15.log"*

All *\<Plan_Storage_Tag\>* , *\<Job_Name\>* and *\<Build_Number\>* can be found in the build logs when browsing build results.  

Let me know if you have more questions on this. If none show up and you find this answer useful, please set this as an accepted answer.


author: Steve Holzer
body: Hi Daniel,

I was afraid of that. We have a non-typical usage of remote agents. We generate the remote agents dynamically for each job. Upon completion of the job the agent is killed and the agent build logs are also removed when this happens.

I'll accept your answer to my original question and thanks for working on the second question. I'll pursue the question with our TAM.

Regards,

Steve Holzer


author: Daniel Santos
body: Thank you [@Steve Holzer](/t5/user/viewprofilepage/user-id/749490),

I hope you can find an easy way to do this. Perhaps you could try transferring the log files using a final task on each job. This would always transfer the log results even if the build fails.