// Find Errors
// Search for errors in the last 6 hours.
// To create an alert for this query, click '+ New alert rule'
// Blog - https://techcommunity.microsoft.com/t5/azure-database-for-postgresql/how-do-i-check-logs-for-azure-database-for-postgresql/ba-p/3618983
AzureDiagnostics
| where Resource == "VARUND-PG1"
| where Category == "PostgreSQLLogs"
| where TimeGenerated > ago(6h)
// Statement (Query) level logging
// Blog - https://techcommunity.microsoft.com/t5/azure-database-for-postgresql/how-to-enable-query-logging-in-azure-database-for-postgresql/ba-p/3639626
AzureDiagnostics
| where Resource == "VARUND-PG1"
| where Category == "PostgreSQLLogs"
| where TimeGenerated > ago(3h)
| where processId_d == "4271"
| project TimeGenerated, Message
// Setting Alerts
// Doc - https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/howto-configure-and-access-logs
AzureDiagnostics
| where Resource == "VARUND-PG1"
| where Category == "PostgreSQLLogs"
| where TimeGenerated > ago(3h)
| where sqlerrcode_s == "42P07"
Last active
November 2, 2022 15:45
-
-
Save varun-dhawan/5baa7e54f01b773103d7a86089156a55 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment