Skip to content

Commit da82b33

Browse files
committed
screenshots added and doc updated
1 parent 3291bb8 commit da82b33

File tree

4 files changed

+253
-18
lines changed

4 files changed

+253
-18
lines changed

docs/integrations/microsoft-azure/azure-cosmos-db-for-postgresql.md

Lines changed: 247 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
1515
For Azure Cosmos DB for PostgreSQL, you can collect the following logs and metrics:
1616

1717
* **PostgreSQL Server Logs**. These logs are available for every node of a cluster and can be used to identify, troubleshoot, and repair configuration errors and suboptimal performance.
18-
* **Audit Logs**. Audit logging of database activities is available through [pgAudit](https://www.pgaudit.org/) extension. By default, pgAudit log statements are emitted along with your regular log statements by using Postgres's standard logging facility. To learn more about the audit log format, refer to the [pgAudit documentation](https://github.com/pgaudit/pgaudit/blob/master/README.md#format).
18+
19+
* **Activity logs**. Provides insight into any subscription-level or management group level events that have occurred in the Azure. To learn more, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log-schema).
20+
1921
* **Metrics**. These metrics are available for every node of a cluster, and in aggregate across the nodes. For more information on supported metrics, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/cosmos-db/postgresql/concepts-monitoring#list-of-metrics).
2022

2123
## Setup
@@ -29,32 +31,263 @@ You must explicitly enable diagnostic settings for each Azure Cosmos DB for Post
2931

3032
When you configure the event hubs source or HTTP source, plan your source category to ease the querying process. A hierarchical approach allows you to make use of wildcards. For example: `Azure/CosmosDBforPostgreSQL/Logs`, `Azure/CosmosDBforPostgreSQL/Metrics`.
3133

34+
35+
### Configure field in field schema
36+
37+
1. [**Classic UI**](/docs/get-started/sumo-logic-ui-classic). In the main Sumo Logic menu, select **Manage Data > Logs > Fields**. <br/>[**New UI**](/docs/get-started/sumo-logic-ui). In the top menu select **Configuration**, and then under **Logs** select **Fields**. You can also click the **Go To...** menu at the top of the screen and select **Fields**.
38+
2. Search for the following fields:
39+
- `tenant_name`. This field is tagged at the collector level. You can get the tenant name using the instructions in the [Microsoft Documentation](https://learn.microsoft.com/en-us/azure/active-directory-b2c/tenant-management-read-tenant-name#get-your-tenant-name).
40+
- `location`. The region to which the resource name belongs to.
41+
- `subscription_id`. ID associated with a subscription where the resource is present.
42+
- `resource_group`. The resource group name where the Azure resource is present.
43+
- `provider_name`. Azure resource provider name (for example, Microsoft.Network).
44+
- `resource_type`. Azure resource type (for example, storage accounts).
45+
- `resource_name`. The name of the resource (for example, storage account name).
46+
- `service_type`. Type of the service that can be accessed with a Azure resource.
47+
- `service_name`. Services that can be accessed with an Azure resource (for example, Azure SQL databases in Azure SQL Server).
48+
3. Create the fields if they are not present. Refer to [Manage fields](/docs/manage/fields/#manage-fields).
49+
50+
### Configure Field Extraction Rules
51+
52+
Create the following Field Extraction Rules (FER) for Azure Storage by following the instructions in the [Create a Field Extraction Rule](/docs/manage/field-extractions/create-field-extraction-rule/). Create the below rules if they are not present.
53+
54+
#### Azure location extraction FER
55+
56+
```sql
57+
Rule Name: AzureLocationExtractionFER
58+
Applied at: Ingest Time
59+
Scope (Specific Data): tenant_name=*
60+
```
61+
62+
```sql title="Parse Expression"
63+
json "location", "properties.resourceLocation", "properties.region" as location, resourceLocation, service_region nodrop
64+
| replace(toLowerCase(resourceLocation), " ", "") as resourceLocation
65+
| if (!isBlank(resourceLocation), resourceLocation, location) as location
66+
| if (!isBlank(service_region), service_region, location) as location
67+
| if (isBlank(location), "global", location) as location
68+
| fields location
69+
```
70+
71+
#### Resource ID extraction FER
72+
73+
```sql
74+
Rule Name: AzureResourceIdExtractionFER
75+
Applied at: Ingest Time
76+
Scope (Specific Data): tenant_name=*
77+
```
78+
79+
```sql title="Parse Expression"
80+
json "resourceId", "ResourceId" as resourceId1, resourceId2 nodrop
81+
| if (isBlank(resourceId1), resourceId2, resourceId1) as resourceId
82+
| toUpperCase(resourceId) as resourceId
83+
| parse regex field=resourceId "/SUBSCRIPTIONS/(?<subscription_id>[^/]+)" nodrop
84+
| parse field=resourceId "/RESOURCEGROUPS/*/" as resource_group nodrop
85+
| parse regex field=resourceId "/PROVIDERS/(?<provider_name>[^/]+)" nodrop
86+
| parse regex field=resourceId "/PROVIDERS/[^/]+(?:/LOCATIONS/[^/]+)?/(?<resource_type>[^/]+)/(?<resource_name>.+)" nodrop
87+
| parse regex field=resource_name "(?<parent_resource_name>[^/]+)(?:/PROVIDERS/[^/]+)?/(?<service_type>[^/]+)/?(?<service_name>.+)" nodrop
88+
| if (isBlank(parent_resource_name), resource_name, parent_resource_name) as resource_name
89+
| fields subscription_id, location, provider_name, resource_group, resource_type, resource_name, service_type, service_name
90+
```
91+
92+
### Configure metric rules
93+
94+
Create the following metrics rules by following the instructions in [Create a metrics rule](/docs/metrics/metric-rules-editor/#create-a-metrics-rule). Create the below rules if they are not present.
95+
96+
#### Azure observability metadata extraction flexible postgresql server level
97+
98+
```sql
99+
Rule Name: AzureObservabilityMetadataExtractionAzureCosmosDBForPostgreSQLLevel
100+
```
101+
102+
```sql title="Metric match expression"
103+
resourceId=/SUBSCRIPTIONS/*/RESOURCEGROUPS/*/PROVIDERS/MICROSOFT.DBFORPOSTGRESQL/FLEXIBLESERVERS/* tenant_name=*
104+
```
105+
106+
| Fields extracted | Metric rule |
107+
|:------------------|:-------------------------|
108+
| subscription_id | $resourceId._1 |
109+
| resource_group | $resourceId._2 |
110+
| provider_name | MICROSOFT.DBFORPOSTGRESQL|
111+
| resource_type | SERVERGROUPSV2 |
112+
| resource_name | $resourceId._3 |
113+
114+
32115
### Configure metrics collection
33116
34117
In this section, you will configure a pipeline for shipping metrics from Azure Monitor to an Event Hub, on to an Azure Function, and finally to an HTTP Source on a hosted collector in Sumo Logic.
35118
36-
1. [Configure an HTTP Source](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#step-1-configure-an-http-source).
119+
1. Create hosted collector and tag `tenant_name` field. <br/><img src={useBaseUrl('img/integrations/microsoft-azure/Azure-Storage-Tag-Tenant-Name.png')} alt="Azure Tag Tenant Name" style={{border: '1px solid gray'}} width="500" />
120+
2. [Configure an HTTP Source](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#step-1-configure-an-http-source).
37121
2. [Configure and deploy the ARM Template](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#step-2-configure-azure-resources-using-arm-template).
38-
3. [Export metrics to Event Hub](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#step-3-export-metrics-for-a-particular-resource-to-event-hub). Perform below steps for each Azure Cosmos DB for PostgreSQL cluster that you want to monitor.
39-
* Choose `Stream to an event hub` as destination.
40-
* Select `AllMetrics`.
41-
* Use the Event hub namespace created by the ARM template in Step 2 above. You can create a new Event hub or use the one created by ARM template. You can use the default policy `RootManageSharedAccessKey` as the policy name.
122+
3. [Export metrics to Event Hub](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#step-3-export-metrics-for-a-particular-resource-to-event-hub). Perform below steps for each Flexible PostgreSQL Server resource that you want to monitor.
123+
1. Choose `Stream to an event hub` as destination.
124+
1. Select `AllMetrics`.
125+
1. Use the Event hub namespace created by the ARM template in Step 2 above. You can create a new Event hub or use the one created by ARM template. You can use the default policy `RootManageSharedAccessKey` as the policy name. <br/><img src={useBaseUrl('img/send-data/export-metrics-diagnostic-settings-cosmosdbforpostgresql.png')} alt="Azure flexible postgresql server metrics" style={{border: '1px solid gray'}} width="800" />
126+
1. Tag the location field in the source with right location value. <br/><img src={useBaseUrl('img/integrations/microsoft-azure/Azure-Storage-Tag-Location.png')} alt="Azure CosmosDB for PostgreSql Tag Location" style={{border: '1px solid gray'}} width="400" />
42127
43128
### Configure logs collection
44129
45130
In this section, you will configure a pipeline for shipping diagnostic logs from Azure Monitor to an Event Hub.
46131
47-
1. To enable audit logs perform below steps:
48-
* [Install the pgAudit extension](https://learn.microsoft.com/en-us/azure/cosmos-db/postgresql/how-to-enable-audit#installing-pgaudit).
49-
* [Configure audit logging](https://learn.microsoft.com/en-us/azure/cosmos-db/postgresql/how-to-enable-audit#pgaudit-settings).
50-
2. To set up the Azure Event Hubs source in Sumo Logic, refer to [Azure Event Hubs Source for Logs](/docs/send-data/collect-from-other-data-sources/azure-monitoring/ms-azure-event-hubs-source/).
51-
3. To create the Diagnostic settings in Azure portal, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/cosmos-db/postgresql/howto-logging#capture-logs). Perform below steps for each Azure Cosmos DB for PostgreSQL cluster that you want to monitor.
52-
* Choose `Stream to an event hub` as the destination.
53-
* Select `allLogs`.
54-
* Use the Event hub namespace and Event hub name configured in previous step in destination details section. You can use the default policy `RootManageSharedAccessKey` as the policy name.
132+
133+
1. To set up the Azure Event Hubs source in Sumo Logic, refer to the [Azure Event Hubs Source for Logs](/docs/send-data/collect-from-other-data-sources/azure-monitoring/ms-azure-event-hubs-source/).
134+
2. To create the diagnostic settings in Azure portal, refer to the [Azure documentation](https://learn.microsoft.com/en-gb/azure/data-factory/monitor-configure-diagnostics). Perform the steps below for each Azure Redis cache account that you want to monitor.
135+
1. Choose **Stream to an event hub** as the destination.
136+
1. Select `allLogs`.
137+
1. Use the Event Hub namespace and Event Hub name configured in the previous step in the destination details section. You can use the default policy `RootManageSharedAccessKey` as the policy name.<br/><img src={useBaseUrl('img/send-data/export-logs-diagnostic-settings-cosmosdbforpostgresql.png')} alt="Azure flexible postgresql server logs" style={{border: '1px solid gray'}} width="800" />
138+
3. Set server parameters as below:
139+
- `log_statement`. Select **DDL**.
140+
- `log_lock_waits`. Set to **ON**. You can also configure `deadlock_timeout` if required.
141+
- `log_connections`. Set to **ON**.
142+
- `log_disconnections`. Set to **ON**.
143+
- `log_duration`. Set to **ON**. You can also configure `log_min_duration_statement` if required.
144+
- `log_hostname`. Set to **ON**.
145+
- `log_min_error_statement`. Set to **INFO**.
146+
- `log_min_messages`. Set to **INFO**.
147+
- `log_line_prefix`. Set to `%m [%p][%v] : %q[app=%a]`.
148+
149+
4. Tag the location field in the source with right location value. <br/><img src={useBaseUrl('img/integrations/microsoft-azure/Azure-Storage-Tag-Location.png')} alt="Azure Redis Cache Tag Location" style={{border: '1px solid gray'}} width="400" />
150+
151+
#### Activity Logs
152+
153+
To collect activity logs, follow the instructions [here](/docs/integrations/microsoft-azure/audit). Skip this step if you are already collecting activity logs for a subscription.
154+
155+
:::note
156+
Since this source contains logs from multiple regions, ensure that you do not tag this source with the location tag.
157+
:::
158+
159+
## Installing the Azure Cosmos DB for PostgreSQL app
160+
161+
Now that you have set up data collection, install the Azure Database for PostgreSQL Sumo Logic app to use the pre-configured dashboards that provide visibility into your environment for real-time analysis of overall usage.
162+
163+
import AppInstallNoDataSourceV2 from '../../reuse/apps/app-install-index-apps-v2.md';
164+
165+
### Overview
166+
167+
The **Azure Cosmos DB for PostgreSQL - Overview** dashboard provides details about replication lag, active connections and query duration distribution across clusters and servers.
168+
169+
Use this dashboard to:
170+
* Track replication lag across replica clusters.
171+
* Analyse query execution duration distribution and common errors across all servers.
172+
* Identify clusters with max cpu usage, memory usage and storage usage.
173+
174+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Overview.png')} alt="Azure Cosmos DB for PostgreSQL - Overview dashboard" style={{border: '1px solid gray'}} width="800" />
175+
176+
### Network
177+
178+
The **Azure Cosmos DB for PostgreSQL - Network** dashboard provides insights on active connections, failed Ccnnections and network activity including ingress and egress bytes.
179+
180+
Use this dashboard to:
181+
182+
* Quickly identify connection errors across clusters.
183+
* Monitor active connections, ingress and egress trends across clusters.
184+
* Identify abnormally long sessions.
185+
186+
187+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Network.png')} alt="Azure CosmosDB for PostgreSql - Network" style={{border: '1px solid gray'}} width="800" />
188+
189+
### Errors
190+
191+
The **Azure Cosmos DB for PostgreSQL - Errors** dashboard provides insight into server error logs by specifically monitoring errors, and database shutdown/start events.
192+
193+
Use this dashboard to:
194+
195+
* Quickly identify top errors across clusters and servers.
196+
* Monitor error trends and distribution across clusters and servers.
197+
* Identify unexpected database shutdown or start activity.
198+
199+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Errors.png')} alt="Azure CosmosDB for PostgreSql - Errors" style={{border: '1px solid gray'}} width="800" />
200+
201+
202+
### Security
203+
204+
The **Azure Cosmos DB for PostgreSQL - Security** dashboard provides insight into locations of incoming connections, failed authentications and top database errors and warnings.
205+
206+
Use this dashboard to:
207+
208+
* Monitor incoming connections, failed authorization requests, and failed authentication requests.
209+
* Track the user performing failed authentication attempts across servers.
210+
211+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Security.png')} alt="Azure CosmosDB for PostgreSql - Security" style={{border: '1px solid gray'}} width="800" />
212+
213+
### Storage
214+
215+
The **Azure Cosmos DB for PostgreSQL - Storage** dashboard provides details about data usage, document count, and physical partition size by database.
216+
217+
Use this dashboard to:
218+
* Monitor the storage utilisation to decide on scaling up storage or scaling out the nodes if this metric exceeds 85 percent consistently.
219+
* Track total storage used across the clusters.
220+
221+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Storage.png')} alt="Azure Cosmos DB for PostgreSQL - Storage dashboard" style={{border: '1px solid gray'}} width="800" />
222+
223+
### Performance
224+
225+
The **Azure Cosmos DB for PostgreSQL - Performance** dashboard provides insights into the performance of your Azure Cosmos DB for PostgreSQL databases. This includes metrics on query duration, server side latency, and failed queries.
226+
227+
Use this dashboard to:
228+
* Track clusters approaching the maximum IOPS capacity, to decide on adding worker nodes.
229+
* Identify clusters using a high percentage of the cluster’s available memory to decide on scaling up the compute if this metric consistently exceeds 90 percent.
230+
* Monitor the CPU usage to decide on scaling up compute if this metric exceeds 95 percent consistently.
231+
232+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Performance.png')} alt="Azure Cosmos DB for PostgreSQL - Performance dashboard" style={{border: '1px solid gray'}} width="800" />
233+
234+
235+
### Queries
236+
237+
The **Azure Cosmos DB for PostgreSQL - Queries** dashboard provides insights into the queries executed in your Azure Cosmos DB for PostgreSQL databases.
238+
239+
Use this dashboard to:
240+
* Analyze query execution duration distribution across servers.
241+
* Identify query statements with errors.
242+
* Monitor spike in query duration.
243+
244+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Queries.png')} alt="Azure Cosmos DB for PostgreSQL - Queries dashboard" style={{border: '1px solid gray'}} width="800" />
245+
246+
### Health
247+
248+
The **Azure Cosmos DB for PostgreSQL - Health** dashboard provides information of any service health incidents or resource health events associated with Azure Cosmos DB for PostgreSQL accounts in your azure account.
249+
250+
Use this dashboard to:
251+
* View recent resource and service health incidents.
252+
* View distribution of service and resource health by incident type.
253+
* Monitor service availability.
254+
255+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Health.png')} alt="Azure Cosmos DB for PostgreSQL - Health dashboard" style={{border: '1px solid gray'}} width="800" />
256+
257+
### Administrative Operations
258+
259+
The **Azure Cosmos DB for PostgreSQL - Administrative Operations** dashboard provides details on users performing admin operations.
260+
261+
Use this dashboard to:
262+
* Identify top users performing administrative operations.
263+
* View top 10 operations that caused the most errors.
264+
* View recent diagnostic, network, and replication settings updates operations.
265+
266+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.us-east-1.amazonaws.com/dashboards/Azure-CosmosDB-for-PostgreSQL/Azure-Cosmos-DB-for-PostgreSQL-Administrative-Operations.png')} alt="Azure Cosmos DB for PostgreSQL - Administrative Operations dashboard" style={{border: '1px solid gray'}} width="800" />
267+
268+
269+
<AppInstallNoDataSourceV2/>
270+
271+
## Viewing the Azure Cosmos DB for PostgreSQL dashboards
272+
273+
import ViewDashboards from '../../reuse/apps/view-dashboards.md';
274+
275+
<ViewDashboards/>
55276
56277
## Troubleshooting
57278
58279
### HTTP Logs and Metrics Source used by Azure Functions
59280
60281
To troubleshoot metrics collection, follow the instructions in [Collect Metrics from Azure Monitor > Troubleshooting metrics collection](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#troubleshooting-metrics-collection).
282+
283+
## Upgrade/Downgrade the Azure Cosmos DB for PostgreSQL app (Optional)
284+
285+
import AppUpdate from '../../reuse/apps/app-update.md';
286+
287+
<AppUpdate/>
288+
289+
## Uninstalling the Azure Cosmos DB for PostgreSQL app (Optional)
290+
291+
import AppUninstall from '../../reuse/apps/app-uninstall.md';
292+
293+
<AppUninstall/>

0 commit comments

Comments
 (0)