Action Trail預設為每個阿里雲帳號記錄最近90天的事件。為了能夠追溯90天以前的事件,您可以建立跟蹤,將操作事件投遞到Object Storage Service、Log ServiceSLS或MaxCompute,以便對事件進行分析。
介面說明
通過 API 建立的跟蹤預設處於已關閉狀態,您需要調用介面 StartLogging 開啟跟蹤,Action Trail才能投遞操作事件至目標雲產品。
前提條件
建立跟蹤之前,請您確保至少完成下列的一項儲存配置:
-
投遞到Object Storage Service
請確保您已開通Object Storage Service,且已建立儲存空間(Bucket)。
-
投遞到Log Service SLS
請確保您已開通Log Service,且已建立記錄項目。
說明建立跟蹤時,Action Trail會自動在目標記錄項目下建立一個名為
actiontrail_<跟蹤名稱>的日誌庫(Logstore),該日誌庫禁止其他資料寫入,保證審計資料的準確性。 -
投遞到MaxCompute MaxCompute
請確保您已開通MaxCompute MaxCompute。
說明建立跟蹤時,Action Trail會自動在專案管理中建立一個名為
actiontrail_<帳號 ID>的專案,該專案禁止其他資料寫入,保證審計資料的準確性。
使用說明
本文將提供一個樣本,為您建立一個名為trail-test的單帳號跟蹤,將操作事件投遞到名為audit-log的 OSS 儲存空間中。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
actiontrail:CreateTrail |
create |
*Trail
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| Name |
string |
是 |
建立的跟蹤名稱。 說明
同一個帳號內跟蹤名稱不可重複。 |
trail-test |
| OssBucketName |
string |
否 |
跟蹤投遞的 OSS 儲存空間。 說明
OssBucketName、SlsProjectArn、MaxComputeProjectArn 需至少指定其中一個參數。 |
audit-log |
| OssKeyPrefix |
string |
否 |
跟蹤投遞的 OSS 儲存空間檔案名稱的首碼,可為空白。 |
at-product-account-audit-B |
| OssWriteRoleArn |
string |
否 |
Action Trail向Object Storage Service 儲存空間投遞操作事件時,扮演的角色 ARN。
|
acs:ram::15127787691****:role/aliyunserviceroleforactiontrail |
| SlsProjectArn |
string |
否 |
跟蹤投遞的Log Service專案的 ARN。 說明
OssBucketName、SlsProjectArn、MaxComputeProjectArn 需至少指定其中一個參數。 |
acs:log:cn-shanghai:151266687691****:project/test-project |
| SlsWriteRoleArn |
string |
否 |
Action Trail向Log Service專案投遞操作事件時,扮演的角色 ARN。
|
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| EventRW |
string |
否 |
投遞事件的讀寫類型,取值:
|
Write |
| TrailRegion |
string |
否 |
跟蹤的地區。 |
All |
| IsOrganizationTrail |
boolean |
否 |
是否建立多帳號跟蹤,取值:
|
false |
| MaxComputeProjectArn |
string |
否 |
跟蹤投遞的MaxCompute專案的 ARN。 說明
OssBucketName、SlsProjectArn、MaxComputeProjectArn 需至少指定其中一個參數。 說明
MaxComputeProjectArn 中指定的MaxCompute專案名稱必須以 actiontrail_作為首碼。 |
acs:odps:cn-hangzhou:15127787691****:project/actiontrail_**** |
| MaxComputeWriteRoleArn |
string |
否 |
Action Trail向MaxCompute專案投遞操作事件時,扮演的角色 ARN。
|
acs:ram::15127787691****:role/aliyunserviceroleforactiontrail |
關於公用請求參數的詳情,請參見公用參數。
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| EventRW |
string |
投遞事件的讀寫類型。 |
Write |
| HomeRegion |
string |
跟蹤的 Home 地區。 |
cn-hangzhou |
| MaxComputeProjectArn |
string |
跟蹤投遞的MaxCompute專案的 ARN。 |
acs:odps:cn-hangzhou:151266687691****:project/actiontrail_**** |
| MaxComputeWriteRoleArn |
string |
Action Trail向MaxCompute專案投遞操作事件時,扮演的角色 ARN。 |
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| Name |
string |
跟蹤名稱。 |
trail-test |
| OssBucketName |
string |
OSS 儲存空間。 |
audit-log |
| OssKeyPrefix |
string |
OSS 儲存空間檔案名稱的首碼。 |
at-product-account-audit-B |
| OssWriteRoleArn |
string |
Action Trail向Object Storage Service 儲存空間投遞操作事件時,扮演的角色 ARN。 |
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| RequestId |
string |
請求 ID。 |
442DDADF-DA58-4029-8E8B-82C73E9A7A70 |
| SlsProjectArn |
string |
跟蹤投遞的Log Service專案的 ARN。 |
acs:log:cn-hangzhou:151266687691****:project/test-project |
| SlsWriteRoleArn |
string |
Action Trail向Log Service專案投遞操作事件時,扮演的角色 ARN。 |
acs:ram::151266687691****:role/aliyunserviceroleforactiontrail |
| TrailRegion |
string |
跟蹤的地區。 |
All |
樣本
正常返回樣本
JSON格式
{
"EventRW": "Write",
"HomeRegion": "cn-hangzhou",
"MaxComputeProjectArn": "acs:odps:cn-hangzhou:151266687691****:project/actiontrail_****",
"MaxComputeWriteRoleArn": "acs:ram::151266687691****:role/aliyunserviceroleforactiontrail",
"Name": "trail-test",
"OssBucketName": "audit-log",
"OssKeyPrefix": "at-product-account-audit-B",
"OssWriteRoleArn": "acs:ram::151266687691****:role/aliyunserviceroleforactiontrail",
"RequestId": "442DDADF-DA58-4029-8E8B-82C73E9A7A70",
"SlsProjectArn": "acs:log:cn-hangzhou:151266687691****:project/test-project",
"SlsWriteRoleArn": "acs:ram::151266687691****:role/aliyunserviceroleforactiontrail",
"TrailRegion": "All"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | InvalidDeliveryConfigurationException | You must specify at least one Log Service project or OSS bucket for a Trail. | |
| 400 | InvalidPrefixException | The specified OSS bucket prefix is invalid. | 指定的OSS首碼無效。 |
| 400 | InvalidQueryParameter | The specified query parameter is invalid. | 無效的查詢參數。 |
| 400 | InvalidTrailNameException | The specified Trail name is invalid. | 跟蹤名稱無效,請修改。 |
| 400 | RepeatOssBucket | The specified OSS bucket is already in use. We recommend that you modify the existing Trail or specify another bucket. | |
| 400 | SlsProjectDoesNotExistException | The specified Log Service project does not exist. | |
| 400 | TrailAlreadyExistsException | The specified Trail name already exists. | 您輸入的跟蹤名稱已存在,如需建立新跟蹤請修改跟蹤名稱。 |
| 400 | MaximumNumberOfOrganizationTrailExceeded | Your account can create only one organization trail. | 您的帳號只能建立一個多帳號跟蹤。 |
| 400 | NotAllowCreateOrganizationTrail | Your account does not allow you to create organization trail. Submit a ticket to get customer support. | 您的帳號不允許建立多帳號跟蹤,請提交工單聯絡客戶支援。 |
| 403 | InsufficientBucketPolicyException | Access to the specified OSS bucket was denied. | |
| 403 | InsufficientSlsPolicyException | Access to the specified Log Service project was denied. | 無法訪問指定的SLS Project。 |
| 403 | MaximumNumberOfTrailsExceededException | The number of Trails in the same region exceeds the upper limit (5). | 同一地區最多可以建立5個跟蹤。 |
| 404 | BucketDoesNotExistException | The specified OSS bucket does not exist. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。