Skip to content

Databricks

Databricks is a data and analytics platform; DRACO reads its audit log system table through a SQL warehouse.

  • What DRACO uses: The audit log system table (system.access.audit).
  • What for: Detections and hunts on workspace and account activity.

Add it in Connectors > Add connector: pick Databricks, then choose what DRACO collects and what it may change. Add more later with Add a part on its connector page. See Connectors for how connectors, sign-in and tags work.

Parts

Part What DRACO uses Access Permissions
Logs Databricks audit logs read A service principal with an OAuth secret and Can use on a SQL warehouse.
USE CATALOG on system, USE SCHEMA on system.access and SELECT on system.access.audit only.

Requirements

  • A Databricks account on the Premium or Enterprise plan with at least one workspace attached to a Unity Catalog metastore.
  • The system table system.access.audit holds the events of every workspace of the account in the same cloud region as the metastore (account-level events are global and appear with workspace id 0). For workspaces in several regions, add one data source per region.
  • A SQL warehouse in that workspace.

Logs

The Databricks audit logs data source (databricks_audit_log) reads the Unity Catalog system table system.access.audit of your Databricks account: sign-ins, personal access tokens, admin and permission changes, Unity Catalog grants, secret reads, IP access lists, downloads and exports, workspace settings and much more. It works the same on AWS, Azure and GCP.

DRACO runs a small SQL query on a SQL warehouse in your workspace on every poll, through the Databricks SQL Statement Execution API. Nothing has to be deployed and no log delivery has to be configured.

Your SQL warehouse is billed for every poll

System tables are free, but Databricks bills the compute that queries them. Each poll starts (or keeps running) the warehouse you pick, so the cost is on your Databricks bill, not DRACO's. Keep it low:

  • use the smallest serverless SQL warehouse (2X-Small), dedicated to DRACO, with the shortest auto-stop your workspace allows;
  • keep the poll interval at 15 minutes or more (the default); polling more often does not make events arrive sooner, because the table itself is updated with a delay (see Latency);
  • a classic or pro warehouse also works but starts in minutes instead of seconds and costs more while idle until it stops.

Client setup (Databricks admin)

  1. Check that the audit table is visible. In the workspace, open Catalog > system > access. If the access schema is missing, an account admin enables it (Databricks CLI: databricks system-schemas enable <metastore-id> access). The metastore must use privilege model version 1.0.
  2. Create a service principal (account console > User management > Service principals > Add service principal) and add it to the workspace (workspace Settings > Identity and access > Service principals > Add). If your workspace still lists the Databricks SQL access entitlement, give it to the service principal.
  3. Create an OAuth secret for it (the service principal > Secrets > Generate secret). Copy the client ID (the application ID) and the secret; the secret is shown once. Note its expiry date: rotate the DRACO credential before it expires.
  4. Create or pick the SQL warehouse (SQL Warehouses > Create SQL warehouse: serverless, 2X-Small, short auto-stop). On the warehouse, Permissions > add the service principal with Can use. Copy the warehouse ID (Overview, or the end of the HTTP path /sql/1.0/warehouses/<id>).
  5. Grant read access to the audit table. A metastore admin (or account admin) runs in the SQL editor, with the service principal's application ID:

    GRANT USE CATALOG ON CATALOG system TO `<application-id>`;
    GRANT USE SCHEMA ON SCHEMA system.access TO `<application-id>`;
    GRANT SELECT ON TABLE system.access.audit TO `<application-id>`;
    

    These grants give access to the audit table only, not to your data. 6. IP access list. If the workspace has an IP access list (workspace Settings > Security > IP access list), allow DRACO's outbound address; your DRACO operator gives you the address. Otherwise Databricks refuses DRACO's requests and the test fails. 7. (Optional) Turn on verbose audit logs in the workspace (Settings > Advanced) if you want notebook commands and SQL text in the audit log.

A personal access token of a user with the same grants also works (token credential), but a service principal is recommended: it does not depend on a person, and its OAuth tokens last one hour.

Add the source in DRACO

  1. Connectors > Add connector, pick Databricks and tick Logs under Collectors (or Add a part on the Databricks connector you already have).
  2. Settings: the workspace URL (https://dbc-xxxxxxxx-xxxx.cloud.databricks.com, https://adb-<id>.<n>.azuredatabricks.net or https://<id>.<n>.gcp.databricks.com; only https:// URLs of Databricks-hosted domains are accepted), the SQL warehouse ID and the poll interval (15 minutes by default). Optional: only some workspace IDs or services, how far the first run looks back (24 hours), the re-read window for late rows (60 minutes) and the rows per run (5,000).
  3. Credential: an OAuth client credential with the client ID and secret (vendor databricks), or a Token credential with a personal access token. You can create it in the wizard.
  4. Test connection: DRACO signs in, runs SELECT 1 on the warehouse, then reads a sample of the audit table and shows the parsed events. The source is created only after a passing test. A stopped classic warehouse may need more time to start than the test waits: start it, then test again.

What DRACO collects

One event per audit row:

Event field From the row
time event_time
action service_name.action_name, for example accounts.tokenLogin, secrets.getSecret, unityCatalog.updatePermissions
actor_user user_identity.email, else identity_metadata.run_by or request_params.user
src_ip, user_agent source_ip_address, user_agent
host the workspace ID (account for account-level events)
cloud_account the Databricks account ID
status success for HTTP 2xx in response.status_code, failure otherwise
class Authentication for sign-ins (login, tokenLogin, samlLogin, oidcTokenAuthorization...), API Activity for the rest
message who ran what where, and the result: [email protected] ran accounts.tokenLogin in workspace 1234567890123456 from 203.0.113.40: succeeded
fields the whole row, including request_params, response, identity_metadata, audit_level and event_id; for token creation also token_lifetime_days (-1: no expiry)

Search examples:

source_type=databricks_audit_log status=failure | stats count by actor_user, action
source_type=databricks_audit_log action=secrets.getSecret | stats count by actor_user, request_params.scope
source_type=databricks_audit_log action=unityCatalog.updatePermissions | table ts, actor_user, request_params.securable_full_name, request_params.changes

IDs resolved (Readable IDs): account user management events name the target user (targetUserId → targetUserName). The audit rows carry no workspace name and no ID of the caller (only the e-mail).

Latency

Databricks does not publish a delivery time for system tables; rows typically appear about 15 minutes after the event and sometimes later. DRACO therefore re-reads the last 60 minutes on every poll (configurable up to 6 hours) and skips the rows it already stored, so late rows are not lost and nothing is stored twice. The built-in rules look back two hours for the same reason. The table keeps 365 days of events.

Each run reads at most rows per run rows in time order; when there are more, the next run continues exactly after the last row read. If the warehouse is still starting when a run's time is up (a few minutes at most), the query is left running and the next run reads its result, so no DRACO worker waits for a warehouse.

Built-in rules

The draco-core pack has these rules for this source (Detections > Built-in). The ones marked recommended are on by default.

Rule Severity Fires on
Admin rights granted (recommended) high accounts.setAdmin, accounts.setAccountAdmin, a principal added to the admins group
IP access list changed or disabled (recommended) high accounts.create/update/deleteIpAccessList, workspaceConfEdit of enableIpAccessLists
Verbose audit logs turned off (recommended) high workspaceConfEdit of enableVerboseAuditLogs to false
Many downloads or exports by one user high 20 or more databrickssql.downloadQueryResult, notebook.downloadLargeResults, notebook.downloadPreviewResults, workspace.workspaceExport in two hours
Personal access token created medium accounts.generateDbToken
Token without expiry or longer than 90 days medium accounts.generateDbToken with no expiry or more than 90 days
Many secret reads or listings by one principal medium 20 or more secrets.getSecret, listSecrets, listScopes in two hours
Notebook results downloaded in full medium notebook.downloadLargeResults
Many failed sign-ins for one user medium 10 or more failed sign-ins in two hours
Service principal OAuth secret created medium servicePrincipalCredentials.create
Security setting or cluster policy changed medium workspaceConfEdit of token, download, export, web terminal, DBFS browser or init script settings; clusterPolicies.edit or delete
Permissions or grants changed low Unity Catalog updatePermissions (GRANT/REVOKE), workspace ACLs, role and permission assignments, secret scope ACLs

Each rule has What to do guidance (triage, likely false positives, containment).

Troubleshooting

The test or a run says Fix
refused the credentials (HTTP 401) / refused the OAuth secret Check the client ID (application ID) and secret, that the secret has not expired and that the service principal is added to this workspace.
denied the request (HTTP 403): CAN USE on the SQL warehouse Give the service principal Can use on the warehouse.
answered 404 The warehouse ID is wrong, or the URL is not the workspace's own URL.
cannot read system.access.audit Run the three GRANT statements of step 5.
system.access.audit cannot be found The workspace is not on Unity Catalog, or the access system schema is not enabled (step 1).
the SQL warehouse is still pending The warehouse is starting; serverless starts in seconds, classic in minutes. Start it and test again.
refused to return that much Lower First run looks back or Rows per run.
rate limit reached Databricks throttled the API; DRACO retried, and the next run continues from the same point.

Not covered yet

  • Audit log delivery to your own storage (S3, Azure Event Hubs or diagnostic settings, GCS) instead of the system table: accounts without a SQL warehouse cannot be read.