稽核和監視資料共用
本文說明數據提供者和收件者如何使用稽核記錄來監視 Delta Sharing 事件。 提供者稽核記錄提供者所採取的動作,以及提供者共享數據上收件者所採取的動作。 接收者稽核日誌記錄存取共用和管理提供者物件相關的事件。
若要檢視清單 Delta Sharing 稽核記錄事件,請參閱 Delta Sharing 事件。
需求
若要存取稽核記錄,帳戶管理員必須為您的 Azure Databricks 帳戶啟用稽核記錄系統數據表。 請參閱 啟用系統數據表。 如需稽核記錄系統數據表的資訊,請參閱 稽核記錄系統數據表參考。
如果您不是帳戶管理員或中繼存放區管理員,則必須獲得讀取稽核記錄的 system.access.audit
存取權。
在稽核記錄中檢視 Delta Sharing 事件
如果您的帳戶已啟用系統數據表,稽核記錄會儲存在 中 system.access.audit
。 或者,如果您的帳戶具有 稽核日誌傳送設定,您必須知道日誌傳送的儲存槽和路徑。
記錄的事件
若要檢視 Delta Sharing 稽核記錄事件的清單,請參閱 Delta Sharing 事件。
檢視收件者查詢結果的詳細數據
Delta Sharing 支援共用資產類型,例如數據表、檢視、具體化檢視、串流功能,以及磁碟區。 Delta Sharing 提供從預先簽署的 URL 或範圍縮小的 STS 令牌獲得基礎數據的暫時讀取權限。 下表概述共享類型如何對應至記錄的稽核記錄事件:
情境 | 稽核記錄事件 |
---|---|
與開放收件者共享的資料表和不具有歷史記錄並與 Databricks 收件者共享的資料表 |
|
與 Databricks 收件者共享記錄的數據表 |
|
磁碟區共用 (STS 令牌型存取) |
|
檢視預簽署的 URL 共用的詳細資訊
在提供者記錄中,在數據收件者的查詢取得預先簽署 URL 共用回應之後,會記錄 deltaSharingQueriedTableChanges
和 deltaSharingQueriedTable
的事件。 供應商可以檢視 response.result
這些記錄的欄位,以查看與收件人共用內容的詳細資訊。 欄位可以包含下列值。 這份清單並不詳盡。
"checkpointBytes": "0",
"earlyTermination": "false",
"maxRemoveFiles": "0",
"path": "file: example/s3/path/golden/snapshot-data0/_delta_log",
"deltaSharingPartitionFilteringAccessed": "false",
"deltaSharingRecipientId": "<redacted>",
"deltaSharingRecipientIdHash": "<recipient-hash-id>",
"jsonLogFileNum": "1",
"scannedJsonLogActionNum": "5",
"numRecords": "3",
"deltaSharingRecipientMetastoreId": "<redacted>",
"userAgent": "Delta-Sharing-Unity-Catalog-Databricks-Auth/1.0 Linux/4.15.0-2068-azure-fips OpenJDK_64-Bit_Server_VM/11.0.7+10-jvmci-20.1-b02 java/11.0.7 scala/2.12.15 java_vendor/GraalVM_Community",
"jsonLogFileBytes": "2846",
"checkpointFileNum": "0",
"metastoreId": "<redacted>",
"limitHint": "Some(1)",
"tableName": "cookie_ingredients",
"tableId": "1234567c-6d8b-45fd-9565-32e9fc23f8f3",
"activeAddFiles": "2", // number of AddFiles returned in the query
"numAddFiles": "2", // number of AddFiles returned in the query
"numAddCDCFiles": "2", // number of AddFiles returned in the CDF query
"numRemoveFiles": "2", // number of RemoveFiles returned in the query
"numSeenAddFiles": "3",
"scannedAddFileSize": "1300", // file size in bytes for the AddFile returned in the query
"scannedAddCDCFileSize": "1300", // file size in bytes for the AddCDCFile returned in the CDF query
"scannedRemoveFileSize": "1300", // file size in bytes for the RemoveFile returned in the query
"scannedCheckpointActionNum": "0",
"tableVersion": "0"
檢視 STS 令牌共用的詳細數據
在提供者記錄中,數據收件者的查詢取得 STS 令牌型共用的回應之後,會記錄 generateTemporaryTableCredentials
和 generateTemporaryVolumeCredentials
的事件。 提供者可以檢視這些記錄的 [request_params
] 數據行,以查看與收件者共用之專案的詳細數據。 欄位可以包含下列值。 這份清單並不詳盡。
"recipient_name": "someRecipientName"
"share_id": "ea7a4555-43d9-4cbd-a5df-f4f5193f297e"
"credential_type": "StorageCredential"
"is_permissions_enforcing_client": "true"
"table_full_name": "someTableName"
"operation": "READ"
"share_name": "someShareName"
"table_id": "someTableId"
"share_owner": "someShareOwner"
"recipient_id": "someRecipientId"
"table_url": "s3://somePath"
"metastore_id": "someMetastoreId"
記錄的錯誤
如果嘗試的 Delta Sharing 動作失敗,則會記錄動作,並在記錄的欄位中顯示錯誤訊息 response.error_message
。
<
和 >
字元之間的項目表示佔位符文字。
提供者記錄中的錯誤訊息
Delta Sharing 會記錄資料提供者的以下錯誤:
選取的元數據存儲中未啟用Delta Sharing。
DatabricksServiceException: FEATURE_DISABLED: Delta Sharing is not enabled
在不存在的目錄上嘗試作業。
DatabricksServiceException: CATALOG_DOES_NOT_EXIST: Catalog ‘<catalog>’ does not exist.
並非帳戶管理員或中繼存放區管理員的使用者嘗試執行特殊權限作業。
DatabricksServiceException: PERMISSION_DENIED: Only administrators can <operation-name> <operation-target>
嘗試在未指派中繼存放區的工作區對該中繼存放區進行操作。
DatabricksServiceException: INVALID_STATE: Workspace <workspace-name> is no longer assigned to this metastore
要求遺漏收件者名稱或共用名稱。
DatabricksServiceException: INVALID_PARAMETER_VALUE: CreateRecipient/CreateShare Missing required field: <recipient-name>/<share-name>
要求包含無效的收件者名稱或共用名稱。
DatabricksServiceException: INVALID_PARAMETER_VALUE: CreateRecipient/CreateShare <recipient-name>/<share-name> is not a valid name
使用者嘗試共用不在 Unity 目錄中繼存放區的資料表。
DatabricksServiceException: INVALID_PARAMETER_VALUE: Only managed or external table on Unity Catalog can be added to a share
使用者嘗試輪替已經處於輪替狀態且先前的權杖尚未過期的收件者。
DatabricksServiceException: INVALID_PARAMETER_VALUE: There are already two active tokens for recipient <recipient-name>
使用者嘗試建立新的收件者,或共用與現有收件者相同的名稱。
DatabricksServiceException: RECIPIENT_ALREADY_EXISTS/SHARE_ALREADY_EXISTS: Recipient/Share <name> already exists`
使用者嘗試對不存在的收件者或共用項目執行作業。
DatabricksServiceException: RECIPIENT_DOES_NOT_EXIST/SHARE_DOES_NOT_EXIST: Recipient/Share '<name>' does not exist
使用者嘗試將資料表加入至共用,但該資料表已存在。
DatabricksServiceException: RESOURCE_ALREADY_EXISTS: Shared Table '<name>' already exists
使用者嘗試執行參考不存在的資料表的作業。
DatabricksServiceException: TABLE_DOES_NOT_EXIST: Table '<name>' does not exist
使用者嘗試執行參考不存在的結構描述的作業。
DatabricksServiceException: SCHEMA_DOES_NOT_EXIST: Schema '<name>' does not exist
使用者嘗試存取不存在的共享資源。
DatabricksServiceException: SHARE_DOES_NOT_EXIST: Share <share-name> does not exist.
收件者記錄中的錯誤訊息
Delta Sharing 會記錄資料收件者的下列錯誤:
使用者嘗試存取沒有存取權限的共享資源。
DatabricksServiceException: PERMISSION_DENIED: User does not have SELECT on Share <share-name>
使用者嘗試存取不存在的共享資源。
DatabricksServiceException: SHARE_DOES_NOT_EXIST: Share <share-name> does not exist.
使用者嘗試存取不存在於共用中的資料表。
DatabricksServiceException: TABLE_DOES_NOT_EXIST: <table-name> does not exist.