PostgreSQLLogs — PostgreSQL Server Logs
The raw Postgres engine log stream. One record per log line. This is the only category that is free to export.
Kusto query
let server = "my-pg-prd-1";
AzureDiagnostics
| where Category == "PostgreSQLLogs" and LogicalServerName_s == server
| project errorLevel_s, sqlerrcode_s, timestamp_s, processId_d,
backend_type_s, Message, AdditionalFields
Fields
Event content
Message(string) — the full formatted log line (timestamp, PID, level, text).errorLevel_s(string) — severity:LOG,WARNING,ERROR,FATAL,PANIC,DEBUG…sqlerrcode_s(string) — Postgres SQLSTATE code (00000= success/no error).timestamp_s(string) — engine-emitted timestamp of the event (UTC).processId_d(number) — OS PID of the backend that produced the line.backend_type_s(string) — backend type:client backend,checkpointer,autovacuum worker,walwriter…AdditionalFields(dynamic) — extra key/value context (e.g. locale info).
Statement fields (present when log_statement or log_min_duration_statement fires)
statement_s(string) — the SQL text of the logged statement.detail_s(string) — extended detail, e.g. bind-parameter values for prepared statements.applicationName_s(string) — value ofapplication_nameset by the client.userName_s(string) — Postgres role that executed the statement.databaseName_s(string) — database the statement ran against.clientHost_s(string) — client hostname or IP address.clientPort_d(number) — client TCP port.
Server / build metadata
AppType_s/ServerType_s(string) —PostgreSQL.AppImage_s(string) — container image of the engine.AppVersion_s/ServerVersion_s(string) — engine build label.ServerLocation_s(string) — environment:region (e.g.prod:francecentral).Region_s(string) — region.OriginalPrimaryServerName_s(string) — original primary (relevant for restored/replica servers).
Use cases — troubleshooting
- Connection failures & auth issues —
FATAL/ERRORlines: bad password,no pg_hba.conf entry, SSL required, role doesn't exist. - Application errors — surface SQLSTATE (
sqlerrcode_s) for deadlocks (40P01), serialization failures (40001), constraint violations (23xxx), syntax errors (42xxx). - "Too many connections" —
53300/ connection-limit rejections. - Slow queries — statements logged via
log_min_duration_statement(duration lines). - Crashes / restarts & recovery —
PANIC/FATAL, startup/shutdown, checkpoint and recovery messages. - Disk / resource pressure —
could not extend file, out-of-memory, temp-file warnings,disk full. - Replication problems — WAL sender/receiver errors, standby disconnects.
- Lock waits / deadlocks —
deadlock detectedand lock-wait log entries (withlog_lock_waits). - Config & extension load errors — failed
ALTER SYSTEM, parameter and library load failures.