cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to capture cuurent_user in custom audit logs in job

Avinash_Narala
Contributor

Hi,

I want to build custom audit log in my job.

But when I do so, I'm able to capture everything except the current_user() who is running the job, How can I capture it in my custom audit log in my job itself.

1 REPLY 1

Kaniz_Fatma
Community Manager
Community Manager

Hi @Avinash_Narala

  • Databricks provides system tables that store audit logs. You can query these tables to retrieve information about job executions, including user identities.
  • Within your Databricks job, you can add custom logging to capture the current user.
  • Use the dbutils.notebook.getContext().tags().get("user") method to retrieve the current userโ€™s email address.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group