Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do you get the build log using REST API?

Peter Kahn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 8, 2013

Hi all,

Does anyone know the right way to get the build log via rest because using artifacts delivers an incorrect url?

Getting The Reference

I have a build a build with one job1. I get the list of artifacts via this:

.../rest/api/latest/result/TRUNK-X64LINUX-JOB1-537?os_authType=basic&expand=artifacts

I see an artifact called 'Build Log' and attempt to use its 'link' to obtain it. However, link doesn't match actual location of artifact.

Concrete Links

REST link for Build Log: <bambooBaseUrl>/download/TRUNK-X64LINUX-JOB1-537/build_logs/TRUNK-X64LINUX-JOB1-537.log

Actual link for Build Log: <bambooBaseUrl>/download/TRUNK-X64LINUX-JOB1/build_logs/TRUNK-X64LINUX-JOB1-537.log

Link Format Difference

REST: /download/<project>-<plan>-<job>-<#>/build_logs/<project>-<plan>-<job>-<#>.log

Actual: /download/<project>-<plan>-<job>/build_logs/<project>-<plan>-<job>-<#>.log

I'm confused why we are seeing the difference. I could just devine the link structure via hashing the names but I'd like to have a make my solution less bamboo version specific.

Please let me know if I'm not following an appropriate REST path for accessing the build log

Thanks

Peter

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 10, 2013

You should be able to use Result resource. Just add expand=logEntries instead of artifacts.

.../rest/api/latest/result/TRUNK-X64LINUX-JOB1-537?os_authType=basic&expand=logEntries

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2015

Seems there is no way to get *just* the log count.. We are seeing really bad peformance issues around the JMS tailLog .onMessage() event and trying to track down offending plans. Even the "size" of logEntries is impacted by max-results, and so to get adequate details need - https://server/bamboo/rest/api/1.0/result/PLAN-JOB-80?max-results=2000000 - and that is brutally slow.

Like Roman Stoffel likes this
EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2015

Er sorry, my point was - is this something I can query from the DB? LOG_SIZE on BRS table is null for completed jobs.

TAGS
AUG Leaders

Atlassian Community Events