Sub topic 10
What audit logs record and why they matter
This chapter assumes you can write basic SQL and have a Unity Catalog metastore with system tables enabled. You should also be able to read a three-level table name such as main.sales.orders. Lineage tells you how data flows. Audit logs tell you who did what, and when.
What an audit log is
An audit log is an append-only record of actions taken in a system. In Databricks, each event is one row. An event answers four questions:
- Who acted (a user, group member, or service principal)?
- What did they do (the service and the action)?
- On which object, and with what parameters?
- Did the request succeed or fail?
Databricks exposes these events in the system table system.access.audit. You read it with ordinary SQL, so you can filter, join, and aggregate it like any other table.
What gets recorded
Events come from many services, not only Unity Catalog. The service_name column tells them apart. For governance work, the most useful values are:
| Area | Typical events |
|---|---|
| Unity Catalog metadata | Reading table metadata, creating or dropping objects, changing grants |
| Authentication | Logins and failed logins |
| Workspace and compute | Cluster, job, and notebook activity |
| Account administration | Changes to users, groups, and workspaces |
Unity Catalog events include requests such as getTable, createTable, and updatePermissions. A request that is denied is still logged, with an error status code. Failed attempts are often the most interesting rows.
The audit table records actions and metadata requests. It does not store your table contents. It can tell you that someone asked for the definition of main.sales.daily_revenue. It does not show which rows they saw.
A first look
This query lists which services are producing events, so you can see what your account records:
SELECT
service_name,
count(*) AS event_count
FROM system.access.audit
WHERE event_date >= current_date() - INTERVAL 7 DAYS
GROUP BY service_name
ORDER BY event_count DESC;Filter on event_date whenever you can. The table is large, and a date filter limits how much data the query scans.
Why audit logs matter
- Accountability. When a table changes or disappears, the log shows who did it and when.
- Access reviews. You can check who actually reads sensitive tables, not only who is allowed to.
- Security monitoring. Repeated denied requests from one user can point to a misconfigured job or to probing.
- Compliance evidence. Auditors usually want proof of controls. Query results from the log are that proof.
- Impact analysis. Lineage shows what depends on a table. The audit log shows who uses those dependents.
Common misunderstandings
- Logs are not instant. System tables are populated with some delay. Do not rely on them for real-time alerting.
- Logs are not kept forever. System table retention is limited, so export data you must keep longer.
- Absence of a row is not proof of no access. Check that the action you care about is an event type the service records.
The next chapter looks at the columns of system.access.audit in detail.
Exercise
A colleague says the audit log will show exactly which rows of main.sales.daily_revenue a user viewed. Is that correct? What can the log tell you instead?
Show answer
No. The audit log records actions and metadata requests, not table contents. It can show who requested or changed the table, which action they took, when, and whether the request succeeded or was denied.