审核和监视数据共享

本文介绍了数据提供者和接收者如何使用审核日志监视 Delta Sharing 事件。 提供者执行的提供者审核日志记录操作以及接收者对提供者的共享数据执行的操作。 与访问共享和管理提供者对象相关的接收者审核日志记录事件。

若要查看 Delta Sharing 审核日志事件列表,请参阅 Delta Sharing 事件

要求

要访问审核日志,帐户管理员必须为 Azure Databricks 帐户启用审核日志系统表。 请参阅启用系统表。 有关审核日志系统表的信息,请参阅审核日志系统表参考

如果你不是帐户管理员或元存储管理员,那么你必须有权访问 system.access.audit 才能读取审核日志。

在审核日志中查看 Delta Sharing 事件

如果帐户启用了系统表,审核日志将存储在 system.access.audit 中。 或者,如果你的帐户具有审核日志传递设置,你需要知道日志传递的 Bucket 和路径。

记录的事件

若要查看 Delta Sharing 审核日志事件的列表,请参阅 Delta Sharing 事件

查看接收者查询结果的详细信息

在提供者日志中,在数据接收者的查询获取响应后会记录返回为 deltaSharingQueriedTableChangesdeltaSharingQueriedTable 的事件。 提供者可以查看这些日志的 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"

记录的错误

如果尝试的 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 Catalog 元存储中的表。

    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.