Azure PostgreSQL Flexible Server — Diagnostic Logs

All 8 log categories available in Diagnostic Settings · Fields · KQL queries

Click a category card to see its fields and KQL examples.

Shared fields — present in every category (AzureDiagnostics)

FieldDescriptionExample value
TimeGeneratedUTC timestamp when log was recorded2024-06-01T12:34:56Z
ResourceServer name in UPPERCASE (AzureDiagnostics)MYPGSERVER
LogicalServerName_sServer name lowercase (resource-specific tables)mypgserver
CategoryLog category namePostgreSQLLogs
SubscriptionIdAzure subscription GUIDxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
ResourceGroupResource group namerg-prod-db
ResourceProviderAlways MICROSOFT.DBFORPOSTGRESQL
ResourceTypeAlways FlexibleServers
OperationNameOperation typeLogEvent
TenantIdAzure AD tenant GUIDxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
TypeAzureDiagnostics or resource-specific table nameAzureDiagnostics
_ResourceIdFull ARM resource URI/subscriptions/.../flexibleServers/mypgserver

PostgreSQLLogs — specific fields

FieldDescriptionExample value
errorLevel_sPostgreSQL severity levelLOG, ERROR, NOTICE, WARNING, FATAL, PANIC
processId_dPostgreSQL backend process ID12345
sqlerrcode_sSQLSTATE code (SQL standard conventions)42P01 (undefined_table), 08006 (connection failure), 00000 (success)
MessagePrimary log message textconnection received: host=10.0.0.5 port=54321
DetailSecondary detail message (if applicable)Key (id)=(42) already exists.
ColumnNameColumn name involved (if applicable)user_id
SchemaNameSchema name involved (if applicable)public
DatatypeNameData type name involved (if applicable)integer
⚠️ Log events larger than 65 KB are silently dropped by Azure Monitor. Complex query plans involving nested views may appear truncated or missing.

How logs flow from PostgreSQL to your workspace

PostgreSQL engine
Diagnostic Settings (max 5)
Destination
📊 Log Analytics workspace
Query with KQL. Use resource-specific tables (recommended) or AzureDiagnostics.
📦 Azure Storage
Archive / compliance. Set retention policy to auto-delete after N days.
📡 Event Hubs
Stream to SIEM or third-party tools in real time.
🤝 Partner solutions
Datadog, Elastic, etc. via Azure Monitor partner integrations.
Destination table modes — Log Analytics
ModeTablesNotes
AzureDiagnosticsAzureDiagnostics (single mixed table)All categories merged. Column names get _s / _d suffixes. Legacy — not recommended.
Resource-specific ✅PGSQLServerLogs, PGSQLPgStatActivitySessions, PGSQLQueryStoreRuntime, etc.One table per category. Better performance, clean schema. Strongly recommended.
Category groups
GroupIncludes
auditPostgreSQLLogs only
allLogsAll 8 categories
⚠️ First log ingestion can take 30–60 minutes after enabling a Diagnostic Setting. Log Analytics retains data free for the first 31 days; charges apply beyond that per GB/day.