หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Important
Azure Cosmos DB for PostgreSQL is on a retirement path and no longer recommended for new projects. Instead, use one of these two services:
For PostgreSQL workloads: use the Elastic Clusters feature of Azure Database For PostgreSQL to use the horizontal scale-out and distributed PostgreSQL features contained within the open source Citus extension. For migration guidance, see migrate to Azure Database for PostgreSQL with Elastic Cluster.
For NoSQL workloads, use Azure Cosmos DB for NoSQL for a distributed database solution that includes a 99.999% availability service level agreement (SLA), instant autoscale, and automatic failover across multiple regions.
PostgreSQL database server logs are available for every node of a cluster. You can ship logs to a storage server, or to an analytics service. The logs can be used to identify, troubleshoot, and repair configuration errors and suboptimal performance.
Capture logs
To access PostgreSQL logs for a coordinator or worker node, you have to enable the PostgreSQL Server Logs diagnostic setting. On your cluster's page in the Azure portal, select Diagnostic settings from the left menu, and then select Add diagnostic setting.
Enter a name for the new diagnostic setting, select the PostgreSQL Server Logs box, and check the Send to Log Analytics workspace box. Then select Save.
View logs
To view and filter the logs, you use Kusto queries. On your cluster's page in the Azure portal, select Logs from the left menu. Close the opening splash screen and the query selection screen.
Paste the following query into the query input box, and then select Run.
AzureDiagnostics
| project TimeGenerated, Message, errorLevel_s, LogicalServerName_s
The preceding query lists log messages from all nodes, along with their severity
and timestamp. You can add where clauses to filter the results. For instance,
to see errors from the coordinator node only, filter the error level and server
name like in the following query. Replace the server name with the name of your server.
AzureDiagnostics
| project TimeGenerated, Message, errorLevel_s, LogicalServerName_s
| where LogicalServerName_s == 'example-cluster-c'
| where errorLevel_s == 'ERROR'
The coordinator node name has the suffix -c and worker nodes are named
with a suffix of -w0, -w1, and so on.
The Azure logs can be filtered in different ways. Here's how to find logs within the past day whose messages match a regular expression.
AzureDiagnostics
| where TimeGenerated > ago(24h)
| order by TimeGenerated desc
| where Message matches regex ".*error.*"