Monitor Azure SQL Database via Azure log analytics

89 Views Asked by At

I have a sql database. I need to get logs from sql database in log analytics workspace. I enabled Diagnostic Settings for SQL Database. How do I query log in log analytics workspace?

For example, here is my sql query:

select * from Employees where Country = 'US'

Can I query something similar in log analytics? This is what worked for me in log analytics:

AzureDiagnostics | where Category == "SQLSecurityAuditEvents" | sort by TimeGenerated desc

but how do I query select * from Employees where Country = 'US'?

2

There are 2 best solutions below

0
Hamada On

Yes, you can. With log queries in Azure Monitor

0
Francesco Mantovani On

I think I have a better solution for you: Azure SQL Analytics (Preview)

Just go to the Azure Marketplace and download it:

enter image description here

Setup the Log Analytics workspace following [this guide][3].

[3]: https://www.sqlshack.com/getting-started-with-azure-sql-analytics/#:~:text=Azure%20SQL%20Analytics%20(Preview%20function,data%20collection%20across%20multiple%20subscriptions.