3

In Azure DevOps, I have a pipeline, where I need the logs of a specific task. How do I find out which log ID i need to fetch it?

eg. on UI this is the endpoint: https://dev.azure.com/myorg/myspace/_build/results?buildId=1234&view=logs&j=899c4bff-9ac3-12de-4775-50e701812cb4&t=bc949ec8-c945-5220-1d40-d8ea7dab4bda which contains the job and task ids, but these are useless when querying logs.

Same example, url to the logs I need: https://dev.azure.com/myorg/cd642969-da00-4584-ab6a-4b6021c47eff/_apis/build/builds/1234/logs/24

The number of tasks depends on what parameters I set, so the number 24 changes. How do I calculate the log id, if I know the name / id of the job and task?

Should I go through all the ~100 task logs and grep for match in the first lines for the task name? (troll)

  • Hi @József Kertész. Is there any update about this ticket? Feel free to let me know if the answer could give you some help. Just a remind of [this](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) – Kevin Lu-MSFT May 18 '21 at 06:16
  • 1
    Thx for the answer - it helped. – József Kertész May 19 '21 at 08:40

1 Answers1

4

How do I calculate the log id, if I know the name / id of the job and task?

To get the logid with task name, you could try to use the following Rest API: Timeline - Get

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/timeline?api-version=6.0

You could search with task name. Then you could get the target logid:

enter image description here

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28