Skip to content

Commit e6816a8

Browse files
authored
Update howto-configure-and-access-logs.md
Added sample queries for 5 new log categories
1 parent c8cb94a commit e6816a8

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

articles/postgresql/flexible-server/howto-configure-and-access-logs.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,66 @@ For Azure Monitor Logs, logs are sent to the workspace you selected. The Postgre
4545

4646
The following are queries you can try to get started. You can configure alerts based on queries.
4747

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.
4949

5050
```kusto
5151
AzureDiagnostics
5252
| where Resource == "myservername"
5353
| where Category == "PostgreSQLLogs"
5454
| where TimeGenerated > ago(1d)
5555
```
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.
5857

5958
```kusto
6059
AzureDiagnostics
6160
| where Message contains "connection received" and Message !contains "host=127.0.0.1"
6261
| where Category == "PostgreSQLLogs" and TimeGenerated > ago(6h)
6362
```
6463

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.
101+
102+
```kusto
103+
AzureDiagnostics
104+
| where Resource == "myservername"
105+
| where Category =='PostgreSQLFlexDatabaseXacts'
106+
| where TimeGenerated > ago(1d)
107+
```
66108

67109
## Next steps
68110

0 commit comments

Comments
 (0)