Azure Web Apps
The Azure Web Apps app allows you to collect Azure web server and application diagnostics logs and monitor the health of your Azure Web Apps environment. This app provides preconfigured dashboards that allow you to monitor server operation, traffic requests, and response times.
For more information, see Azure Web Apps.
Log and metric types​
For Azure Web Apps, you can collect the following logs and metrics:
-
Resource logs, which provide an insight into operations that were performed within an Azure resource. For a complete schema for resource logs refer to the below documentation:
-
Activity logs, provides insight into any subscription-level or management group level events that have occurred in the Azure. To learn more, refer to Azure documentation.
- Azure WebApps platform metrics. These are metrics specific to Functions like execution count and execution units. For more information on supported metrics, refer to Azure documentation.
Sample log messages​
2017-09-25 23:27:36 eShopCart GET / X-ARR-LOG-ID=9b3056e8-21d5-43f7-8fd7-4aec6b29525e
80 - 60.4.192.44 Mozilla/5.0+(Macintosh+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,
+like+Gecko)+Chrome/60.4.192.44+Safari/537.36 PHPSESSID=tv2iv6tn8c9su542l464ibaro5;
+ARRAffinity=d6c6606b1a249bd37139b09d6c2cb4dd61f6b5cd607f934012aca86bd59515444 -
eShopCart.azurewebsites.net 200 0 0 3098 1008 1000
Sample queries​
_sourceCategory=Azure/Web-app
| parse regex "\d+-\d+-\d+ \d+:\d+:\d+ (?<s_sitename>\S+) (?<cs_method>\S+) (?<cs_uri_stem>\S+) (?<cs_uri_query>\S+) (?<src_port>\S+) (?<src_user>\S+) (?<client_ip>\S+) (?<cs_user_agent>\S+) (?<cs_cookie>\S+) (?<cs_referrer>\S+) (?<cs_host>\S+) (?<sc_status>\S+) (?<sc_substatus>\S+) (?<sc_win32_status>\S+) (?<sc_bytes>\S+) (?<cs_bytes>\S+) (?<time_taken>\S+)"
| timeslice 5m
| count by _timeslice
| outlier _count
Setup​
Azure service sends monitoring data to Azure Monitor, which can then stream data to Eventhub. Sumo Logic supports:
- Logs collection from Azure Monitor using our Azure Event Hubs source.
- Activity Logs collection from Azure Monitor using our Azure Event Hubs source. It is recommended to create a separate source for activity logs. If you are already collecting these logs, you can skip this step.
- Metrics collection using our HTTP Logs and Metrics source via Azure Functions deployed using the ARM template.
You must explicitly enable diagnostic settings for each web app that you want to monitor. You can forward logs to the same event hub provided they satisfy the limitations and permissions as described here.
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/WebApps/Logs
, Azure/WebApps/Metrics
.
Configure field in field schema​
- Classic UI. In the main Sumo Logic menu, select Manage Data > Logs > Fields.
New 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. - Search for following fields:
tenant_name
. This field is tagged at the collector level and you can get the tenant name using the instructions here.location
. The region to which the resource name belongs to.subscription_id
. ID associated with a subscription where resource is present.resource_group
. The resource group name where the Azure resource is present.provider_name
. Azure resource provider name (for example, Microsoft.WEB).resource_type
. Azure resource type (for example, SITES).resource_name
. The name of the resource (for example, Azure Function App name).
- Create the fields if they are not present. Refer to Manage fields.
Configure Field Extraction Rules​
Create a Field Extraction Rule (FER) by following the instructions here. If the FER already exists with same name, then skip this step.
Azure Location Extraction FER​
Rule Name: AzureLocationExtractionFER
Applied at: Ingest Time
Scope (Specific Data): tenant_name=*
json "location", "properties.resourceLocation", "properties.region" as location, resourceLocation, service_region nodrop
| replace(toLowerCase(resourceLocation), " ", "") as resourceLocation
| if (!isBlank(resourceLocation), resourceLocation, location) as location
| if (!isBlank(service_region), service_region, location) as location
| if (isBlank(location), "global", location) as location
| fields location
Resource ID Extraction FER​
Rule Name: AzureResourceIdExtractionFER
Applied at: Ingest Time
Scope (Specific Data): tenant_name=*
json "resourceId", "ResourceId" as resourceId1, resourceId2 nodrop
| if (isBlank(resourceId1), resourceId2, resourceId1) as resourceId
| toUpperCase(resourceId) as resourceId
| parse regex field=resourceId "/SUBSCRIPTIONS/(?<subscription_id>[^/]+)" nodrop
| parse field=resourceId "/RESOURCEGROUPS/*/" as resource_group nodrop
| parse regex field=resourceId "/PROVIDERS/(?<provider_name>[^/]+)" nodrop
| parse regex field=resourceId "/PROVIDERS/[^/]+(?:/LOCATIONS/[^/]+)?/(?<resource_type>[^/]+)/(?<resource_name>.+)" nodrop
| parse regex field=resource_name "(?<parent_resource_name>[^/]+)(?:/PROVIDERS/[^/]+)?/(?<service_type>[^/]+)/?(?<service_name>.+)" nodrop
| if (isBlank(parent_resource_name), resource_name, parent_resource_name) as resource_name
| fields subscription_id, location, provider_name, resource_group, resource_type, resource_name, service_type, service_name
Configure metric rules​
Azure Observability Metadata Extraction Service Level​
If this rule already exists, there's no need to create it again.
Rule Name: AzureObservabilityMetadataExtractionAppServiceLevel
resourceId=/SUBSCRIPTIONS/*/RESOURCEGROUPS/*/PROVIDERS/*/SITES/* tenant_name=*
Fields extracted | Metric rule |
---|---|
subscription_id | $resourceId._1 |
resource_group | $resourceId._2 |
provider_name | $resourceId._3 |
resource_type | SITES |
resource_name | $resourceId._4 |
Configure metrics collection​
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.
- Configure an HTTP Source.
- Configure and deploy the ARM Template.
- Export metrics to Event Hub. Perform below steps for each Azure WebApps that you want to monitor.
- Choose
Stream to an event hub
as destination. - Select
AllMetrics
. - 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.
- Choose
Configure logs collection​
Diagnostic logs​
In this section, you will configure a pipeline for shipping diagnostic logs from Azure Monitor to an Event Hub.
- To set up the Azure Event Hubs source in Sumo Logic, refer to the Azure Event Hubs Source for Logs.
- To create the Diagnostic setting in the Azure portal, refer to the Azure documentation. Perform the below steps for each Azure WebApps that you want to monitor.
- Choose
Stream to an event hub
as the destination. - Select
HTTP logs
,App Service Console Logs
,App Service Application Logs
,Access Audit Logs
,IPSecurity Audit logs
,App Service Platform logs
,Report Antivirus Audit Logs
,Site Content Change Audit Logs
. - 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.
- Choose
- Tag the location field in the source with right location value.
Activity logs (optional)​
To collect activity logs, follow the instructions here. If you are already collecting activity logs for a subscription, do not perform this step.
Since this source contains logs from multiple regions, make sure that you do not tag this source with the location tag.
Enabling Microsoft Defender for Cloud​
For Security events, make sure you enable Microsoft Defender for Cloud. In Defender Plans Settings page toggle the App Service status under Cloud Workload Protection section.
Enabling health check metric​
For getting health check metric, make sure you enable Health check under the Monitoring dropdown.
Installing the Azure Web Apps app​
This section provides instructions on how to install the Azure Web Apps app, and shows examples of each of the preconfigured dashboards you can use to analyze your data.
To install the app, do the following:
- Select App Catalog.
- In the 🔎 Search Apps field, run a search for your desired app, then select it.
- Click Install App.
note
Sometimes this button says Add Integration.
- Click Next in the Setup Data section.
- In the Configure section of your respective app, complete the following fields.
- Key. Select either of these options for the data source.
- Choose Source Category and select a source category from the list for Default Value.
- Choose Custom, and enter a custom metadata field. Insert its value in Default Value.
- Key. Select either of these options for the data source.
- Click Next. You will be redirected to the Preview & Done section.
Post-installation
Once your app is installed, it will appear in your Installed Apps folder, and dashboard panels will start to fill automatically.
Each panel slowly fills with data matching the time range query and received since the panel was created. Results will not immediately be available, but will update with full graphs and charts over time.
Viewing Azure Web Apps dashboards​
All dashboards have a set of filters that you can apply to the entire dashboard. Use these filters to drill down and examine the data to a granular level.
- You can change the time range for a dashboard or panel by selecting a predefined interval from a drop-down list, choosing a recently used time range, or specifying custom dates and times. Learn more.
- You can use template variables to drill down and examine the data on a granular level. For more information, see Filtering Dashboards with Template Variables.
- Most Next-Gen apps allow you to provide the scope at the installation time and are comprised of a key (
_sourceCategory
by default) and a default value for this key. Based on your input, the app dashboards will be parameterized with a dashboard variable, allowing you to change the dataset queried by all panels. This eliminates the need to create multiple copies of the same dashboard with different queries.
Overview​
The Azure WebApps - Overview dashboard provides comprehensive information of all the service health incidents or resource health events associated with Azure WebApps in your azure account.
Use this dashboard to:
- View recent resource and service health incidents.
- View distribution of service and resource health by incident type.
Antivirus Scan Audit​
The Azure WebApps - Antivirus Scan Audit dashboard provides detailed insights into the antivirus scan results and audit logs associated with your Azure WebApps.
Use this dashboard to:
- View recent antivirus scan results and their statuses.
- Analyze audit logs for compliance and security checks.