You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/postgresql/flexible-server/howto-configure-and-access-logs.md
+46-4Lines changed: 46 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,24 +45,66 @@ For Azure Monitor Logs, logs are sent to the workspace you selected. The Postgre
45
45
46
46
The following are queries you can try to get started. You can configure alerts based on queries.
47
47
48
-
Search for all Postgres logs for a particular server in the last day
48
+
Search for all Postgres logs for a particular server in the last day.
49
49
50
50
```kusto
51
51
AzureDiagnostics
52
52
| where Resource == "myservername"
53
53
| where Category == "PostgreSQLLogs"
54
54
| where TimeGenerated > ago(1d)
55
55
```
56
-
57
-
Search for all non-localhost connection attempts
56
+
Search for all non-localhost connection attempts. Below query will show results over the last 6 hours for any Postgres server logging in this workspace.
58
57
59
58
```kusto
60
59
AzureDiagnostics
61
60
| where Message contains "connection received" and Message !contains "host=127.0.0.1"
62
61
| where Category == "PostgreSQLLogs" and TimeGenerated > ago(6h)
63
62
```
64
63
65
-
The query above will show results over the last 6 hours for any Postgres server logging in this workspace.
64
+
Search for PostgreSQL Sessions collected from `pg_stat_activity` system view for a particular server in the last day.
65
+
66
+
```kusto
67
+
AzureDiagnostics
68
+
| where Resource == "myservername"
69
+
| where Category =='PostgreSQLFlexSessions'
70
+
| where TimeGenerated > ago(1d)
71
+
```
72
+
73
+
Search for PostgreSQL Query Store Runtime statistics collected from `query_store.qs_view` for a particular server in the last day. It requires Query Store to be enabled.
74
+
75
+
```kusto
76
+
AzureDiagnostics
77
+
| where Resource == "myservername"
78
+
| where Category =='PostgreSQLFlexQueryStoreRuntime'
79
+
| where TimeGenerated > ago(1d)
80
+
```
81
+
82
+
Search for PostgreSQL Query Store Wait Statistics collected from `query_store.pgms_wait_sampling_view` for a particular server in the last day. It requires Query Store Wait Sampling to be enabled.
83
+
84
+
```kusto
85
+
AzureDiagnostics
86
+
| where Resource == "myservername"
87
+
| where Category =='PostgreSQLFlexQueryStoreWaitStats'
88
+
| where TimeGenerated > ago(1d)
89
+
```
90
+
91
+
Search for PostgreSQL Autovacuum and Schema statistics for each database in a particular server within the last day.
92
+
93
+
```kusto
94
+
AzureDiagnostics
95
+
| where Resource == "myservername"
96
+
| where Category =='PostgreSQLFlexTableStats'
97
+
| where TimeGenerated > ago(1d)
98
+
```
99
+
100
+
Search for PostgreSQL remaining transactions and multixacts till emergency autovacuum or wraparound protection for each database in a particular server within the last day.
0 commit comments