Audit and monitor data sharing using Delta Sharing (for providers)
This article describes how data providers can use Databricks audit logs to monitor Delta Sharing events, including:
When someone creates, modifies, updates, or deletes a share or a recipient
When a recipient accesses an activation link and downloads the credential
When a recipient accesses shares.
When a recipient accesses data in shared tables.
When a recipient’s credential is rotated or expires.
For information about how data recipients can audit Delta Sharing events to understand who is accessing which data, see Audit and monitor data access using Delta Sharing (for recipients).
Requirements
To access audit logs, you need to enable audit log delivery. See Configure audit log delivery.
View Delta Sharing events in the audit log
You need to know the bucket and path where your account’s audit logs are delivered.
Delta Sharing events have unityCatalog
as their serviceName
. Actions that are performed by recipients start with the deltaSharing
prefix.
Logged event examples
The following audit event logs an update to the recipient token lifetime. In this example, redacted values are replaced with <redacted>
.
{
"version":"2.0",
"auditLevel":"ACCOUNT_LEVEL",
"timestamp":1629775584891,
"orgId":"3049059095686970",
"shardName":"example-workspace",
"accountId":"<redacted>",
"sourceIPAddress":"<redacted>",
"userAgent":"curl/7.64.1",
"sessionId":"<redacted>",
"userIdentity":{
"email":"<redacted>",
"subjectName":null
},
"serviceName":"unityCatalog",
"actionName":"updateMetastore",
"requestId":"<redacted>",
"requestParams":{
"metastore_id":"<redacted>",
"delta_sharing_scope":"INTERNAL_AND_EXTERNAL"
"delta_sharing_recipient_token_lifetime_in_seconds": 31536000
},
"response":{
"statusCode":200,
"errorMessage":null,
"result":null
},
"MAX_LOG_MESSAGE_LENGTH":16384
}
The following audit event logs a recipient’s action to query a table that you, as the provider, have shared with them.
{
"Version": "2.0",
"auditLevel": "ACCOUNT_LEVEL",
"Timestamp": 1635235341950,
"orgId": "0",
"shardName": "example-workspace",
"accountId": "<redacted>",
"sourceIPAddress": "<redacted>",
"userAgent": null,
"sessionId": null,
"userIdentity": null,
"serviceName": "unityCatalog",
"actionName": "deltaSharingQueriedTable",
"requestId": "<redacted>",
"requestParams": {
"Metastore_id": "<redacted>",
"Options": "{}",
"Recipient_name": "ip_recipient"
},
"Response": {
"statusCode": 200,
"errorMessage": null,
"Result": {
"checkpointBytes": "0",
"maxRemoveFiles": "0",
"path": "file: example/s3/path/golden/snapshot-data0/_delta_log",
"scannedAddFileSize": "1300",
"jsonLogFileNum": "1",
"scannedJsonLogActionNum": "5",
"jsonLogFileBytes": "914",
"checkpointFileNum": "0",
"metastoreId": "<redacted>",
"limitHint": "Some(1)",
"tableName": "tableName",
"tableId": "1",
"activeAddFiles": "2",
"scannedCheckpointActionNum": "0",
"deltaSharingRecipientIdHash": "recipient_hash_id",
"tableVersion": "0"
}
},
"MAX_LOG_MESSAGE_LENGTH": 16384
}
Logged event details
The following table lists audited Delta Sharing actions that are delivered to data provider logs. Recipient-initiated events are marked “Recipient action.” Provider-initiated events are marked “Provider action.”
actionName |
requestParams |
---|---|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Recpient action |
|
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
none |
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
none |
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
|
Provider action |
|
In addition to the actions and parameters included in the table, the following are also logged:
Catalog, schema, and table access events. See Unity Catalog events.
Request parameters that are always present in the audit log for each action:
userIdentity.email
: The ID of the user who initiated the activity.requestParams.metastore_id
: the Unity Catalog metastore that manages the shared data.
Response fields for recipient-initiated events
Responses can include the following key-value pairs under Result:
. Values here are examples only. This list is not exhaustive.
"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"
Logged errors
Delta Sharing logs the following errors for data providers. Items between <
and >
characters represent placeholder text.
Delta Sharing is not enabled on the selected metastore.
DatabricksServiceException: FEATURE_DISABLED: Delta Sharing is not enabled
An operation was attempted on a catalog that does not exist.
DatabricksServiceException: CATALOG_DOES_NOT_EXIST: Catalog ‘<catalog>’ does not exist.
A user who is not an account admin or metastore admin attempted to perform a privileged operation.
DatabricksServiceException: PERMISSION_DENIED: Only administrators can <operation-name> <operation-target>
An operation was attempted on a metastore from a workspace to which the metastore is not assigned.
DatabricksServiceException: INVALID_STATE: Workspace <workspace-name> is no longer assigned to this metastore
A request was missing the recipient name or share name.
DatabricksServiceException: INVALID_PARAMETER_VALUE: CreateRecipient/CreateShare Missing required field: <recipient-name>/<share-name>
A request included an invalid recipient name or share name.
DatabricksServiceException: INVALID_PARAMETER_VALUE: CreateRecipient/CreateShare <recipient-name>/<share-name> is not a valid name
A user attempted to share a table that is not in a Unity Catalog metastore.
DatabricksServiceException: INVALID_PARAMETER_VALUE: Only managed or external table on Unity Catalog can be added to a share
A user attempted to rotate a recipient that was already in a rotated state and whose previous token had not yet expired.
DatabricksServiceException: INVALID_PARAMETER_VALUE: There are already two active tokens for recipient <recipient-name>
A user attempted to create a new recipient or share with the same name as an existing one.
DatabricksServiceException: RECIPIENT_ALREADY_EXISTS/SHARE_ALREADY_EXISTS: Recipient/Share <name> already exists`
A user attempted to perform an operation on a recipient or share that does not exist.
DatabricksServiceException: RECIPIENT_DOES_NOT_EXIST/SHARE_DOES_NOT_EXIST: Recipient/Share '<name>' does not exist
A user attempted to add a table to a share, but the table had already been added.
DatabricksServiceException: RESOURCE_ALREADY_EXISTS: Shared Table '<name>' already exists
A user attempted to perform an operation that referenced a table that does not exist.
DatabricksServiceException: TABLE_DOES_NOT_EXIST: Table '<name>' does not exist
A user attempted to perform an operation that referenced a schema that did not exist.
DatabricksServiceException: SCHEMA_DOES_NOT_EXIST: Schema '<name>' does not exist
For a list of auditable events and errors logged for data recipients, see Audit and monitor data access using Delta Sharing (for recipients).