Audit Log - Query

查詢稽核記錄專案

GET https://auditservice.dev.azure.com/{organization}/_apis/audit/auditlog?api-version=7.1-preview.1
GET https://auditservice.dev.azure.com/{organization}/_apis/audit/auditlog?startTime={startTime}&endTime={endTime}&batchSize={batchSize}&continuationToken={continuationToken}&skipAggregation={skipAggregation}&api-version=7.1-preview.1

URI 參數

名稱 位於 必要 類型 Description
organization
path

string

Azure DevOps 組織的名稱。

api-version
query True

string

要使用的 API 版本。 這應該設定為 '7.1-preview.1' 以使用此版本的 API。

batchSize
query

integer

int32

要傳回的結果數目上限。 選擇性

continuationToken
query

string

用來從上一個查詢傳回下一組結果的權杖。 選擇性

endTime
query

string

date-time

下載視窗的結束時間。 選擇性

skipAggregation
query

boolean

略過匯總事件,並改為將它們保留為個別專案。 根據預設,會匯總事件。 匯總的事件種類:AuditLog.AccessLog。

startTime
query

string

date-time

下載視窗的開始時間。 選擇性

回應

名稱 類型 Description
200 OK

AuditLogQueryResult

成功的作業

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

名稱 Description
vso.auditlog 授與讀取稽核記錄和稽核串流給使用者的能力

範例

By date

Sample Request

GET https://auditservice.dev.azure.com/_apis/audit/auditlog?startTime=2019-03-04T14:05:59.928Z&endTime=2019-03-05T14:05:59.928Z&batchSize=2&api-version=7.1-preview.1

Sample Response

{
  "value": {
    "decoratedAuditLogEntries": [
      {
        "id": "2518505060978539161;00000064-0000-8888-8000-000000000000;86fbe369-3f5d-4f52-9ab0-3be7db271948",
        "correlationId": "86fbe369-3f5d-4f52-9ab0-3be7db271948",
        "activityId": "033fde68-f713-4984-b24f-8d7a73d1ade6",
        "actorCUID": "a718550e-4777-4058-8298-bff88d0cb524",
        "actorUserId": "d6a98b6c-6932-485c-a986-aea9fc981df0",
        "authenticationMechanism": "FedAuth",
        "timestamp": "2019-03-05T14:05:02.1460838+00:00",
        "scopeType": "organization",
        "scopeDisplayName": "fabrikam (Organization)",
        "scopeId": "73638cd5-0dda-4128-9fd6-48c16d4e4de3",
        "ipAddress": "167.220.148.131",
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36",
        "actionId": "AuditLog.AccessLog",
        "data": {
          "Filter": {
            "StartTime": "2019-03-04T14:05:59.928Z",
            "EndTime": "2019-03-05T14:05:59.928Z",
            "ContinuationToken": null,
            "BatchSize": 2,
            "HasMore": true
          },
          "EventSummary": [
            "2019-03-05T14:05:02.1460838+00:00",
            "2019-03-05T13:59:40.4899467+00:00",
            "2019-03-05T13:58:13.159128+00:00"
          ]
        },
        "details": "Accessed the audit log 3 times",
        "area": "Auditing",
        "category": "access",
        "categoryDisplayName": "Access",
        "actorDisplayName": "Norman Paulk",
        "actorImageUrl": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.NzdhMTNiN2MtYjIxNy03NDc4LWIxMjItYTlhMTU5YTFlNWQw"
      },
      {
        "id": "2518505063644965580;00000002-0000-8888-8000-000000000000;198b13cf-5201-48e8-acef-0d8bb2d9e815",
        "correlationId": "57f825b4-a940-44a3-a3cc-25cdb9871107",
        "activityId": "01abe2fd-deee-4a47-b35f-dff3edc059a4",
        "actorCUID": "00000000-0000-0000-0000-000000000000",
        "actorUserId": "00000002-0000-8888-8000-000000000000",
        "authenticationMechanism": "",
        "timestamp": "2019-03-05T14:00:35.5034419+00:00",
        "scopeType": "organization",
        "scopeDisplayName": "fabrikam (Organization)",
        "scopeId": "73638cd5-0dda-4128-9fd6-48c16d4e4de3",
        "ipAddress": null,
        "userAgent": "",
        "actionId": "Project.CreateCompleted",
        "data": {
          "ProjectId": "2e0ffea5-d693-4711-862c-94393bacadcb",
          "ProjectName": "fabrikam-fiber-git",
          "ProcessTemplate": "Agile",
          "ProjectVisibility": "Private"
        },
        "details": "fabrikam-fiber-git project was created successfully",
        "area": "Project",
        "category": "create",
        "categoryDisplayName": "Create",
        "actorDisplayName": "Azure DevOps Service",
        "actorImageUrl": null
      }
    ],
    "continuationToken": "2518505063644965580;00000002-0000-8888-8000-000000000000;198b13cf-5201-48e8-acef-0d8bb2d9e815",
    "hasMore": false
  }
}

定義

名稱 Description
AuditActionCategory

執行的動作類型

AuditLogQueryResult

查詢稽核記錄時所傳回的物件。 其中包含記錄檔和查詢更多稽核專案所需的資訊。

AuditScopeType

組織 (範圍的類型只有目前支援的範圍)

DecoratedAuditLogEntry

AuditActionCategory

執行的動作類型

名稱 類型 Description
access

string

已存取成品

create

string

成品已建立

execute

string

成品已執行

modify

string

已修改成品

remove

string

已移除成品

unknown

string

類別未知

AuditLogQueryResult

查詢稽核記錄時所傳回的物件。 其中包含記錄檔和查詢更多稽核專案所需的資訊。

名稱 類型 Description
continuationToken

string

要傳遞以取得下一組結果的接續權杖

decoratedAuditLogEntries

DecoratedAuditLogEntry[]

稽核記錄專案的清單

hasMore

boolean

如果擷取更多相符的結果,則為 True,否則為 false。

AuditScopeType

組織 (範圍的類型只有目前支援的範圍)

名稱 類型 Description
deployment

string

部署

enterprise

string

Enterprise

organization

string

組織

project

string

Project

unknown

string

範圍未知或尚未設定

DecoratedAuditLogEntry

名稱 類型 Description
actionId

string

事件的動作識別碼,例如 Git.CreateRepo、Project.RenameProject

activityId

string

ActivityId

actorCUID

string

動作專案的 CUID

actorClientId

string

如果動作專案是服務) 主體,則動作專案的用戶端識別碼 (

actorDisplayName

string

起始動作之使用者的 DisplayName

actorImageUrl

string

動作專案設定檔影像的 URL

actorUPN

string

動作專案的 UPN

actorUserId

string

如果動作專案是使用者) ,動作專案的使用者識別碼 (

area

string

發生動作的 Azure DevOps 區域

authenticationMechanism

string

動作專案所使用的驗證類型

category

AuditActionCategory

執行的動作類型

categoryDisplayName

string

類別的 DisplayName

correlationId

string

這可讓相關的稽核專案群組在一起。 一般而言,當單一動作造成一連串的稽核專案時,就會發生這種情況。 例如,專案建立。

data

object

外部資料,例如 CUID、專案名稱等。

details

string

裝飾的詳細資料

id

string

EventId - 每個服務都必須是唯一的

ipAddress

string

事件來源的 IP 位址

projectId

string

指定時,此事件所關聯的專案識別碼

projectName

string

指定時,與這個事件相關聯的專案名稱

scopeDisplayName

string

範圍的 DisplayName

scopeId

string

組織識別碼 (組織是唯一支援的範圍)

scopeType

AuditScopeType

組織 (範圍的類型只有目前支援的範圍)

timestamp

string

以 UTC 發生事件的時間

userAgent

string

來自要求的使用者代理程式