Search code examples
azureazure-databricksazure-log-analytics

How to log the user queries in azure databricks?


We have recently turned on diagnostics settings on databricks workspace and chose to send the logs to Log Analytics. We need to prepare usage metrics where we need to track the distinct users and the queries they are executing. I'm able to query the logs and track when are the users logging in but unable to find the user queries. Is there any way we can get the user query information during the login session?


Solution

  • Unfortunately, Azure databricks doesn't log the user queries into Log Analytics.

    I would suggest you to vote up an idea submitted by another Azure customer.

    https://feedback.azure.com/forums/909463-azure-databricks/suggestions/41425570-audit-and-log-notebook-commands

    All of the feedback you share in these forums will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure.


    A diagnostic setting specifies a list of categories of platform logs and/or metrics that you want to collect from a resource, and one or more destinations that you would stream them to.

    enter image description here

    Azure Databricks offers robust functionality for monitoring custom application metrics, streaming query events, and application log messages. Azure Databricks can send this monitoring data to different logging services.

    The following articles show how to send monitoring data from Azure Databricks to Azure Monitor, the monitoring data platform for Azure.