How to find when was the last time a user logged in to Azure Databricks?

schluckie
New Contributor

Hi,

I am asked to prepare a report on Azure Databricks usage in our company. Most metadata I need, like a list of users, workspaces, users rights on workspaces etc. I already have, but I do not know how to determine when the last time was a user logged in to an Azure Databricks workspace. Any suggestions would be highly appreciated.

Mailendiran
New Contributor III

I'm not sure, but have you tried checking in system catalog tables ?

ncf5031
New Contributor II

Hi @schluckie you can check using a query like the one below and just change the ip address to match your conventions, or remove it entirely. 

SELECT event_time, user_identity.email, source_ip_address, action_name, response.status_code
FROM system.access.audit
WHERE action_name IN ('login', 'logout', 'createToken', 'deleteToken')
  AND (response.status_code >= 400 OR source_ip_address NOT LIKE 'xx.%')
  AND event_date >= current_date() - INTERVAL 7 DAYS
ORDER BY event_time DESC