Skip to main content

Sumo Logic App for Azure Web Apps

thumbnail icon

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. The App provides preconfigured Dashboards that allow you to monitor server operation and traffic requests and response times.

For more information on Azure Web Apps, see https://azure.microsoft.com/en-us/se...p-service/web/.

To install the Sumo Logic App for Azure Web Apps, you must sign up for a Sumo Logic account, if you have not already done so. To sign up, go to https://www.sumologic.com/pricing/ and select your account type or click Free Trial to sign up for a Sumo Logic Free account.

Log Types

The Azure Web Apps App supports:

  • Web Server Logging. Information about HTTP transactions using the W3C extended log file format. This is useful when determining overall site metrics such as the number of requests handled or how many requests are from a specific IP address.
  • Application Diagnostics Logs. Application diagnostics allows you to capture information produced by a web application. ASP.NET applications can use the System.Diagnostics.Trace class to log information to the application diagnostics log.

Sample Log Message

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 Query

Traffic over time outlier
_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

Collecting Logs for Azure Web Apps

This section has instructions for configuring a pipeline for shipping Azure Web Apps logs 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.

Solution Overview

The following is how the solution fits together:

  • Azure Monitor collects logs for most Microsoft Azure services, including Azure Web Apps, and streams the data to an Azure Event Hub.
  • Azure Event Hub is a data streaming platform and event ingestion service. In this pipeline, an Event Hub streams the logs collected by Azure Monitor to an Azure function.
  • The Azure function is a small piece of code that is triggered by Event Hub to send logs to the Sumo HTTP Source, function logs to one Storage Account, and failover data to another.

Configure an HTTP source

In this task, you configure an HTTP source to receive logs from the Azure function.

To configure an HTTP source for Azure, do the following:

  1. Do one of the following:
  • Select a hosted collector on which to configure the HTTP source.
  • Create a new hosted collector, as described on Configure a Hosted Collector.
  1. Configure an HTTP source, as described on HTTP Logs and Metrics Source. Make a note of the URL for the source, you will need it in the next step.

Configure Azure Resources using ARM template

In this step, you use a Sumo-provided Azure Resource Manager (ARM) template to create an Event Hub, an Azure function and two Storage Accounts. The Azure function is triggered by Event Hub. Two storage accounts are used to store log messages from the Azure function and failover data from Event Hub.

  1. Download the azuredeploy_logs.json ARM template.

  2. Go to Template deployment in the Azure Portal.

  3. Click Create.

  4. On the Custom deployment blade, click Build your own template in the editor.

  5. Copy the contents of azuredeploy_logs.json, and paste it into the editor window.

  6. Click Save.

  7. Now you are back on the Custom deployment blade.

    1. Create a new Resource Group (recommended) or select an existing one.
    2. Choose Location.
    3. In the Sumo Endpoint URL field, enter the URL of the HTTP Source you configured in Step 1.
    4. Agree to the terms and conditions.
    5. Click Purchase.
  8. Verify the deployment was successful by looking at Notifications at the top right corner of Azure Portal.

  9. (Optional) In the same window, you can click Go to resource group to verify all resources have been created successfully. You will see something like this:

  10. Go to Storage accounts and search for “sumofailmsg”. Click on sumofailmsg_<random-string>.

  11. Under Blob Service, click Containers, then click + Container, enter the Name azureaudit-failover, and select Private for the Public Access Level. Click OK.

If you also want to also collect metrics follow the instructions in Step 2 for Collecting metrics from Azure monitor. The app dashboards currently do not have metric content.

Export logs for a particular Web App to Event Hub

In this task, you enable logs for your Azure Web app. For related information see Enable diagnostics logging for web apps in Azure App Service in the Azure help documentation.

To enable logs for an Azure web app, do the following:

  1. Login to https://portal.azure.com/.
  2. Go to your Azure Web App and in the left pane, go to Monitoring > Diagnostics Settings.
  1. Diagnostic Settings blade will show all your existing settings if any already exist. Click Edit Setting if you want to change your existing settings, or click Add diagnostic setting to add a new one.
  2. Select the Stream to an event hub box checkbox.
  3. Select an Azure subscription.
  4. Select the Event Hubs namespace you created in Step 2. It should start with "SumoAzureLogsNamespace<UniqueSuffix>".
  5. Select insights-operational-logs from the Select Event hub name dropdown.
  6. Select RootManageSharedAccessKey from Select Event hub policy name dropdown.
  7. Select the checkbox for log types under Category Details which you want to ingest.
  8. Click Save.

Export metrics for a particular web app to Event Hub (Optional)

The current Sumo Logic App for Web Apps does not support metric content so this step is optional. For exporting metrics you need to create another diagnostic setting and select All Metrics only with the following Event Hub configurations.

Event Hub Namespace. Namespace created in Step 2 by Metrics ARM template starting with SumoMetricsNamespace<unique suffix>

Event Hub Name. insights-metrics-pt1m

Event Hub Policy. RootManageSharedAccessKey

Troubleshooting

If logs are not flowing into Sumo Logic, see Troubleshooting.

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:

Locate and install the app you need from the App Catalog. If you want to see a preview of the dashboards included with the app before installing, click Preview Dashboards.

  1. From the App Catalog, search for and select the app.
  2. Select the version of the service you're using and click Add to Library. Version selection is applicable only to a few apps currently. For more information, see the Install the Apps from the Library.
  3. To install the app, complete the following fields.
    1. App Name. You can retain the existing name, or enter a name of your choice for the app.

    2. Data Source. Select either of these options for the data source.

      • Choose Source Category, and select a source category from the list.

      • Choose Enter a Custom Data Filter, and enter a custom source category beginning with an underscore. Example: (_sourceCategory=MyCategory).

    3. Advanced. Select the Location in Library (the default is the Personal folder in the library), or click New Folder to add a new folder.
  4. Click Add to Library.

Once an app is installed, it will appear in your Personal folder, or other folder that you specified. From here, you can share it with your organization.

Panels will start to fill automatically. It's important to note that each panel slowly fills with data matching the time range query and received since the panel was created. Results won't immediately be available, but with a bit of time, you'll see full graphs and maps.

Viewing Azure Web Apps Dashboards

Overview

Azure Web Apps dashboards

Visits by Country. Performs a geo location operation to display the IP addresses of visitors on a map of the world for the last three hours.

Response Time and Data Volume. Displays the average response time and data volume in a line chart on a timeline for the last three hours.

Traffic Over Time. Shows the traffic in a line chart on a timeline for the last 24 hours.

OS Platform Breakdown. Provides the operating systems used in a pie chart for the last three hours.

400 and 500 Server Errors. Displays any 400 and 500 server errors in a pie chart for the last 15 minutes.

Traffic Over Time (Outlier). Shows the traffic and any outliers in an outlier chart on a timeline for the last 24 hours.

OS Platform Breakdown by Country. Lists the operating system used by country in a table chart for the last three hours.

Errors by Country. Displays the number of errors by country in a bar chart for the last three hours.

Server Operation - Errors and Response Codes

Azure Web Apps dashboards

Server Errors by Site. Shows details on server errors by site in a column chart for the last three hours.

Response Codes Over Time. Displays the number of response codes over time in a line chart on a timeline for the last three hours.

Application Log Levels Over Time. Shows details on log levels over time in a column chart on a timeline for the last three hours.

Application Errors by Site. Provides details about application errors by site in a line chart on a timeline for the last three hours.

Client Errors. Displays details on client errors in a column chart for the last three hours.

Server Operation - Requests and Response Time

Azure Web Apps dashboards

Requests by Hostname. Displays the number of requests by hostname in a line chart on a timeline for the last three hours.

Requests by Site Over Time. Shows the number of requests by site in a line chart on a timeline for the last three hours.

Top 10 Slowest Pages. Provides details on the top 10 slowest pages in a table chart including information on the URL and the average time in seconds for the last three hours.

Response Time Histogram. Displays response times in a column chart for the last three hours.

Response Throughput. Shows details on response throughput in a table chart including information on the URL and the average throughput in seconds for the last three hours.

Traffic Insights - Apps and Requests

Azure Web Apps dashboards

Visits by Country. Performs a geo lookup operation and displays the IP addresses of worldwide visitors on a map of the world for the last three hours.

US Visits by State. Performs a geo lookup operation and displays the IP addresses of US visitors on a map of the United States for the last three hours.

Requests by App. Displays the number of requests by app in a line chart on a timeline for the last three hours.

Top Clients. Provides details on the top clients by IP address in a bar chart for the last three hours.

Traffic Over Time (Outlier). Shows the traffic and any outliers in an outlier chart on a timeline for the last 24 hours.

Traffic Insights - Content and Client Platform

Azure Web Apps dashboards

Media Types Requested Over Time. Displays media types requested over time by count in a line chart on a timeline in the last three hours.

OSes and Browsers. Shows details on operating systems and browsers used in a column chart for the last three hours.

Top Requested Documents. Provides the top requested documents in a table chart including details on the URL and number of requests for the last three hours.

OS Platform. Displays the different operating systems used in a pie chart for the last three hours.

Top Requested Documents by Country. Lists the top requested documents in a table chart including details on URI, country name, and number of requests for the last three hours.

Top 10 Slowest Pages by Country. Lists the 10 slowest pages by country in a table chart including details on URI, country name, and average time in seconds for the last three hours.

Sumo Logic YouTubeSumo Logic Twitter
Legal
Privacy Statement
Terms of Use

Copyright © 2022 by Sumo Logic, Inc.