Skip to content

Commit ac6822f

Browse files
sachin-sumologicamee-sumoJV0812
authored
Added documentation for azure api management (#4839)
* added documentation for azure api management * delete unwanted files * doc enhancements * doc enhancements * resolved feedback comments * resolved feedback comments * resolved feedback comments * resolved feedback comments * Update azure-api-management.md * Update azure-api-management.md * Update azure-api-management.md * added a subsection * Update docs/integrations/microsoft-azure/azure-api-management.md --------- Co-authored-by: Amee Lepcha <amee.lepcha.ctr@sumologic.com> Co-authored-by: Jagadisha V <129049263+JV0812@users.noreply.github.com>
1 parent edd8b9b commit ac6822f

File tree

4 files changed

+204
-12
lines changed

4 files changed

+204
-12
lines changed

docs/integrations/microsoft-azure/azure-api-management.md

Lines changed: 204 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
88

99
<img src={useBaseUrl('img/integrations/microsoft-azure/azure-api-management.png')} alt="Thumbnail icon" width="50"/>
1010

11-
[Azure API Management](https://learn.microsoft.com/en-us/azure/api-management/api-management-key-concepts) is a hybrid multicloud management platform for APIs across all environments. As a platform-as-a-service, API Management supports the complete API lifecycle. This integration provides near real-time visibility into the state and health of your APIs with rich information about API Management operations that are important for auditing.
11+
[Azure API Management](https://learn.microsoft.com/en-us/azure/api-management/api-management-key-concepts) is a hybrid multicloud platform for managing APIs across different environments. As a platform-as-a-service, it supports the entire API lifecycle and provides near real-time visibility into API status and health, offering essential API Management operations and details for auditing.
1212

1313
## Log and metric types
1414

1515
For Azure API Management, you can collect the following logs and metrics:
1616

17-
* **Resource logs**. To learn more about the resource log schema for Azure API Management, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/api-management/gateway-log-schema-reference). The Consumption tier doesn't support the collection of resource logs.
18-
* **Platform Metrics for Azure API Management**. These metrics are available in [Microsoft.ApiManagement/service](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-apimanagement-service-metrics) namespace.
17+
* **Gateway logs**. To learn more about the resource log schema for Azure API Management, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/api-management/gateway-log-schema-reference). The Consumption tier doesn't support the collection of resource logs.
18+
* **WebSocket connection logs**. To learn more about the resource log schema for Azure API Management, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/apimanagementwebsocketconnectionlogs). The Consumption tier doesn't support the collection of resource logs.
19+
* **Developer portal audit logs**. To learn more about the resource log schema for Azure API Management, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/api-management/developer-portal-audit-log-schema-reference). The Consumption tier doesn't support the collection of resource logs.
20+
* **Platform metrics**. These metrics are available in the [Microsoft.ApiManagement/service](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-apimanagement-service-metrics) namespace.
1921

2022
## Setup
2123

@@ -28,28 +30,218 @@ You must explicitly enable diagnostic settings for each Azure API Management ser
2830

2931
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/APIManagement/Logs`, `Azure/APIManagement/Metrics`.
3032

33+
### Configure field in field schema
34+
35+
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**.
36+
1. Search for the following fields:
37+
- `tenant_name`. This field is tagged at the collector level. You can get the tenant name using the instructions [here](https://learn.microsoft.com/en-us/azure/active-directory-b2c/tenant-management-read-tenant-name#get-your-tenant-name).
38+
- `location`. The region to which the resource name belongs to.
39+
- `subscription_id`. ID associated with a subscription where the resource is present.
40+
- `resource_group`. The resource group name where the Azure resource is present.
41+
- `provider_name`. Azure resource provider name (for example, Microsoft.Network).
42+
- `resource_type`. Azure resource type (for example, storage accounts).
43+
- `resource_name`. The name of the resource (for example, storage account name).
44+
- `service_type`. Type of the service that can be accessed with a Azure resource.
45+
- `service_name`. Services that can be accessed with an Azure resource (for example, in Azure API Management service is Subscriptions).
46+
1. Create the fields if they are not present. Refer to [Manage fields](/docs/manage/fields/#manage-fields).
47+
48+
### Configure field extraction rules
49+
50+
Create the following Field Extraction Rule(s) (FER) for Azure Storage by following the instructions in [Create a Field Extraction Rule](/docs/manage/field-extractions/create-field-extraction-rule/).
51+
52+
#### Azure location extraction FER
53+
54+
```sql
55+
Rule Name: AzureLocationExtractionFER
56+
Applied at: Ingest Time
57+
Scope (Specific Data): tenant_name=*
58+
```
59+
60+
```sql title="Parse Expression"
61+
json "location", "properties.resourceLocation", "properties.region" as location, resourceLocation, service_region nodrop
62+
| replace(toLowerCase(resourceLocation), " ", "") as resourceLocation
63+
| if (!isBlank(resourceLocation), resourceLocation, location) as location
64+
| if (!isBlank(service_region), service_region, location) as location
65+
| if (isBlank(location), "global", location) as location
66+
| fields location
67+
```
68+
69+
#### Resource ID extraction FER
70+
71+
```sql
72+
Rule Name: AzureResourceIdExtractionFER
73+
Applied at: Ingest Time
74+
Scope (Specific Data): tenant_name=*
75+
```
76+
77+
```sql title="Parse Expression"
78+
json "resourceId", "ResourceId" as resourceId1, resourceId2 nodrop
79+
| if (isBlank(resourceId1), resourceId2, resourceId1) as resourceId
80+
| toUpperCase(resourceId) as resourceId
81+
| parse regex field=resourceId "/SUBSCRIPTIONS/(?<subscription_id>[^/]+)" nodrop
82+
| parse field=resourceId "/RESOURCEGROUPS/*/" as resource_group nodrop
83+
| parse regex field=resourceId "/PROVIDERS/(?<provider_name>[^/]+)" nodrop
84+
| parse regex field=resourceId "/PROVIDERS/[^/]+(?:/LOCATIONS/[^/]+)?/(?<resource_type>[^/]+)/(?<resource_name>.+)" nodrop
85+
| parse regex field=resource_name "(?<parent_resource_name>[^/]+)(?:/PROVIDERS/[^/]+)?/(?<service_type>[^/]+)/?(?<service_name>.+)" nodrop
86+
| if (isBlank(parent_resource_name), resource_name, parent_resource_name) as resource_name
87+
| fields subscription_id, location, provider_name, resource_group, resource_type, resource_name, service_type, service_name
88+
```
89+
90+
### Configure metric rules
91+
92+
Create the following metrics rules by following the instructions in [Create a metrics rule](/docs/metrics/metric-rules-editor/#create-a-metrics-rule).
93+
94+
#### Azure observability metadata extraction service level
95+
96+
If this rule already exists, there is no need to create it again.
97+
98+
```sql
99+
Rule Name: AzureObservabilityMetadataExtractionServiceLevel
100+
```
101+
102+
```sql title="Metric match expression"
103+
resourceId=/SUBSCRIPTIONS/*/RESOURCEGROUPS/*/PROVIDERS/*/*/*/*/* tenant_name=*
104+
```
105+
| Fields extracted | Metric rule |
106+
|------------------|----------------|
107+
| subscription_id | $resourceId._1 |
108+
| resource_group | $resourceId._2 |
109+
| provider_name | $resourceId._3 |
110+
| resource_type | $resourceId._4 |
111+
| resource_name | $resourceId._5 |
112+
| service_type | $resourceId._6 |
113+
| service_name | $resourceId._7 |
114+
115+
#### Azure observability metadata extraction application gateway level
116+
117+
```sql
118+
Rule Name: AzureObservabilityMetadataExtractionAppGatewayLevel
119+
```
120+
121+
```sql title="Metric match expression"
122+
resourceId=/SUBSCRIPTIONS/*/RESOURCEGROUPS/*/PROVIDERS/*/APPLICATIONGATEWAYS/* tenant_name=*
123+
```
124+
| Fields extracted | Metric rule |
125+
|:------------------|:------------------------|
126+
| subscription_id | $resourceId._1 |
127+
| resource_group | $resourceId._2 |
128+
| provider_name | MICROSOFT.APIMANAGEMENT |
129+
| resource_type | SERVICE |
130+
| resource_name | $resourceId._3 |
131+
31132
### Configure metrics collection
32133
33134
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.
34135
136+
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" />
35137
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).
36-
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).
37-
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 API Management service that you want to monitor.
138+
1. [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).
139+
1. [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 API Management that you want to monitor.
38140
1. Choose `Stream to an event hub` as destination.
39141
1. Select `AllMetrics`.
40-
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.
142+
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/azure-apimanagement-metrics.png')} alt="Azure application gateway metrics" style={{border: '1px solid gray'}} width="800" />
143+
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 API Management Tag Location" style={{border: '1px solid gray'}} width="400" />
144+
145+
:::note
146+
In the v2 service tiers, API Management has replaced the capacity metric with separate CPU and memory utilization metrics
147+
:::
41148
42149
### Configure logs collection
43150
151+
#### Diagnostic logs
152+
44153
In this section, you will configure a pipeline for shipping diagnostic logs from Azure Monitor to an Event Hub.
45154
46-
1. 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/).
47-
2. To create the Diagnostic settings in Azure portal, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-use-azure-monitor#resource-logs). Perform below steps for each Azure API Management service that you want to monitor.
48-
1. Choose `Stream to an event hub` as the destination.
155+
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/).
156+
1. 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 application gateway account that you want to monitor.
157+
1. Choose **Stream to an event hub** as the destination.
49158
1. Select `allLogs`.
50-
1. 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.
51-
3. By default, logging is enabled for all APIs, to modify the [logging settings](https://learn.microsoft.com/en-us/azure/api-management/diagnostic-logs-reference), refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-use-azure-monitor#modify-api-logging-settings).
52-
4. To log API Management events using [log-to-eventhub](https://learn.microsoft.com/en-us/azure/api-management/log-to-eventhub-policy) policy, refer to the [Azure documentation](https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-log-event-hubs?tabs=arm).
159+
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/azure-apimanagement-logs.png')} alt="Azure API Management logs" style={{border: '1px solid gray'}} width="800" />
160+
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 API Management Tag Location" style={{border: '1px solid gray'}} width="400" />
161+
162+
#### Activity Logs
163+
164+
To collect activity logs, follow the instructions [here](/docs/integrations/microsoft-azure/audit). Do not perform this step in case you are already collecting activity logs for a subscription.
165+
166+
:::note
167+
Since this source contains logs from multiple regions, make sure that you do not tag this source with the location tag.
168+
:::
169+
170+
##### Enabling Microsoft Defender for Cloud
171+
172+
For Security events, make sure you enable [Microsoft Defender for Cloud](https://learn.microsoft.com/en-us/azure/defender-for-cloud/tutorial-enable-app-service-plan#enable-the-defender-for-app-service-plan). In Defender Plans Settings page toggle the **APIs** status under **Cloud Workload Protection (CWP)** section.
173+
174+
<img src={useBaseUrl('img/integrations/microsoft-azure/Microsoft-Cloud-Defender-Edit-Settings.png')} alt="Edit Settings" style={{border: '1px solid gray'}} width="800" />
175+
176+
<img src={useBaseUrl('img/integrations/microsoft-azure/azure-api-management-services.png')} alt="Cloud Defender Plans" style={{border: '1px solid gray'}} width="800" />
177+
178+
## Installing the Azure API Management app
179+
180+
Now that you have set up data collection, install the Azure API Management Sumo Logic app to use the pre-configured dashboards that provide visibility into your environment for real-time analysis of overall usage.
181+
182+
import AppInstallNoDataSourceV2 from '../../reuse/apps/app-install-index-apps-v2.md';
183+
184+
<AppInstallNoDataSourceV2/>
185+
186+
## Viewing the Azure API Management dashboards
187+
188+
import ViewDashboards from '../../reuse/apps/view-dashboards.md';
189+
190+
<ViewDashboards/>
191+
192+
### Administrative Operations
193+
194+
The **Azure API Management - Administrative Operations** dashboard provides details like Top 10 Operations That Caused The Most Errors, Distribution by Operation Type (Read, Write, and Delete), Distribution by Operations, Recent Write Operations, Recent Delete Operations, Users/Applications by Operation type, and Distribution by Status.
195+
196+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/AzureApiManagement/Azure-API-Management-Administrative-Operations.png')} alt="Azure API Management - Overview" style={{border: '1px solid gray'}} width="800" />
197+
198+
### Developer Portal
199+
200+
The **Azure API Management - Developer Portal** dashboard provides details like Total Success Requests, Total Failed Requests, Success Requests vs Failed Requests, Failed Requests by Method, Requests by Response Code, Failed Request Details, and Failed Requests by Resource.
201+
202+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/AzureApiManagement/Azure-API-Management-Developer-Portal.png')} alt="Azure API Management - Overview" style={{border: '1px solid gray'}} width="800" />
203+
204+
### Errors
205+
206+
The **Azure API Management - Errors** dashboard provides details like Failed Backend Requests by Backend Method, Failed Backend Requests by Backend Url, Failed Backend Requests by Backend Protocol, Failed Requests by Method, Failed Requests by Protocol, Requests by Response Code, Requests by Backend Response Code, Failed Requests, Failed Backend Requests, Failed Requests by Url, Top 10 Failed API Urls, Failed Request Details, and Top 3 Caller IPs With Failures by Resource.
207+
208+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/AzureApiManagement/Azure-API-Management-Errors.png')} alt="Azure API Management - Overview" style={{border: '1px solid gray'}} width="800" />
209+
210+
### Overview
211+
212+
The **Azure API Management - Overview** dashboard provides details like Requests by Location, Total Requests by Method, Total Requests by Response Code, Top Operations with Request Size, Top Operations with Response Size, Backend, Top Backend Url by Request Size, Top Backend Urls with Response Size, Websockets, Websocket Connections by Event Name, Websocket Connection Details, Current Capacity Utilization, Total Requests, Requests Summary by Users, API Requests (Today, Yesterday, Last Week), Average Capacity Utilization (%), and CPU (%).
213+
214+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/AzureApiManagement/Azure-API-Management-Overview.png')} alt="Azure API Management - Overview" style={{border: '1px solid gray'}} width="800" />
215+
216+
### Performance
217+
218+
The **Azure API Management - Performance** dashboard provides details like Request Duration by Url, Request Duration by Method, Requests by Response Code, Requests by Result Type, Backend Request Duration by Backend Url, Backend Request Duration by Backend Method, Backend Requests by Response Code, Overall Duration Vs Backend Duration, Successful Requests by Method, Successful Requests by Client Protocol, Top 10 APIs With Highest Backend Execution Duration, and Top 10 APIs With Highest Number of Requests.
219+
220+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/AzureApiManagement/Azure-API-Management-Performance.png')} alt="Azure API Management - Overview" style={{border: '1px solid gray'}} width="800" />
221+
222+
### Policy and Recommendations
223+
224+
The **Azure API Management - Policy and Recommendations** dashboard provides details like Total Recommendation Events, Total Success Policy Events, Total Failed Policy Events, Failed Policy Events, Recent Recommendation Events, Recommendation, and Policy.
225+
226+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/AzureApiManagement/Azure-API-Management-Policy-and-Recommendations.png')} alt="Azure API Management - Overview" style={{border: '1px solid gray'}} width="800" />
227+
228+
### Subscriptions
229+
230+
The **Azure API Management - Subscriptions** dashboard provides details like Total Requests by Subscription, Failed Requests by Subscription, Requests by Subscription, Failed Requests by Subscription, Top 10 Failed Subscription, and Recent Changes in Subscription.
231+
232+
<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/AzureApiManagement/Azure-API-Management-Subscriptions.png')} alt="Azure API Management - Overview" style={{border: '1px solid gray'}} width="800" />
233+
234+
## Upgrade/Downgrade the Azure API Management app (optional)
235+
236+
import AppUpdate from '../../reuse/apps/app-update.md';
237+
238+
<AppUpdate/>
239+
240+
## Uninstalling the Azure API Management app (optional)
241+
242+
import AppUninstall from '../../reuse/apps/app-uninstall.md';
243+
244+
<AppUninstall/>
53245
54246
## Troubleshooting
55247
Loading
Loading
Loading

0 commit comments

Comments
 (0)