question

IngleMahesh-4218 avatar image
0 Votes"
IngleMahesh-4218 asked OuryBa-MSFT commented

Is it possible to find which query was running at particular time with azure log analytics

Is it possible to find which query was running at particular time with azure log analytics?
I need to prepare one dashboard where I can see this information.

azure-sql-database
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @IngleMahesh-4218 Thank you for posting your question on Microsoft Q&A. It is not possible to find which query was running at particular time with Log analytics. You can only audit queries in azure monitor logs. Query auditing is enabled with a diagnostic setting on the log Analytics workspace. You can find more details in Audits queries in Azure monitor Logs.
113472-image.png



Regards,
Oury

0 Votes 0 ·
image.png (230.0 KiB)

Hi @IngleMahesh-4218 I wanted to check if you have any additional query that we can help you with.?

Regards,
Oury

0 Votes 0 ·

Hi @IngleMahesh-4218 I haven't heard back from you and would like to know if there is any further query regarding the above.

Regards,
Oury
.

0 Votes 0 ·

Could you please help me with detailed about SQL audit queries?
Also let me know if we can combine with dashboard.

0 Votes 0 ·

II have implemented same thing but unable to see any queries running out there.
Please assist.

Mahesh Ingle
(Phone number redacted)

0 Votes 0 ·

Hi @IngleMahesh-4218 Thanks for accepting answer and for the giving us good rating. In response the the comment above. (unable to see any queries)
Did you wait at least 20 minutes?

Regards,
Oury

0 Votes 0 ·

Yes. I waited for a long time but still could not see any queries.
Could you please forward me AzureDiagnostics query.

0 Votes 0 ·

Hi @IngleMahesh-4218 You can use the same query I shared below.
AzureDiagnostics
Where Category == " "
where ResourceId == " "
AUDITDBTEST
project
event_time_t,
statement_s,
succeeded_s,
affected_rows_d,
server_prinicpal_name_s,
client_ip_s,

Please let me know if you run into any issues.

Regards,
Oury

0 Votes 0 ·

1 Answer

OuryBa-MSFT avatar image
0 Votes"
OuryBa-MSFT answered

Hi @IngleMahesh-4218 our PG was able to validate that you can see SQL statements in Log Analytics:
So they created a database and enabled auditing using Log Analytics. and ran this query:

--AUDIT Is it possible to find which query was running at particular time with azure log analytics
select getdate()

And a few minutes later (you don’t always see results immediately)
You can view the audit logs in the portal:


115150-image.png

Please let me know if that is not what you are looking for

Regards,
Oury



image.png (140.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.