'TFS/VSTS vNext Build and Release Logs Location

Are the build and release logs saved locally on the Build Agent machine? I know that I can manually click on the "Download all logs as zip" link for each build and release, but if I want to automatically send these logs to someone else (or bulk send them), is there another way to find them (either on the Build Agent machine or in the database somewhere)?

Thanks!



Solution 1:[1]

Both for TFS and VSTS, the build/release logs are located in TFS/VSTS server (no business with what the agent is used).

In build/release retention, you can set the policies to keep the builds/releases. And it default keep the latest 30 days' builds and releases.

Except the way to click "Download all logs as zip" button to get a build/release logs, you can also get build/release logs by REST API. Such as below example:

GET https://account.visualstudio.com/DefaultCollection/Git2/_apis/build/builds/2373/timeline?api-version=2.0

And you can get each build step log in the response, such as:

{
    "records": [
        {
            "id": "d2c6b274-40fe-4727-85b6-eb92fb4f6009",
            "parentId": "ff7265dc-abe3-5e6a-6194-76bb88f00044",
            "type": "Task",
            "name": "Initialize Job",
            "startTime": "2018-01-15T05:30:25.6Z",
            "finishTime": "2018-01-15T05:30:26.0233333Z",
            "currentOperation": null,
            "percentComplete": null,
            "state": "completed",
            "result": "succeeded",
            "resultCode": null,
            "changeId": 8,
            "lastModified": "0001-01-01T00:00:00",
            "workerName": "V-myPC",
            "order": 2,
            "details": null,
            "errorCount": 0,
            "warningCount": 0,
            "url": null,
            "log": {
                "id": 2,
                "type": "Container",
                "url": "https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/2373/logs/2"
            },
            "task": null
        },
        ...
    ],
    "lastChangedBy": "00000002-0000-8888-8000-000000000000",
    "lastChangedOn": "2018-01-15T05:30:40.947Z",
    "id": "4b4280d4-5358-4238-ab95-d44475c92bc9",
    "changeId": 19,
    "url": "https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/2373/Timeline/4b4280d4-5358-4238-ab95-d44475c92bc9"
}

As the above response, you can find the Initialized Job step by the url https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/2373/logs/2.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marina Liu