Azure Function Monitoring

How To Monitor Azure Functions

In this Azure tutorial, we will discuss Azure Functions monitoring options and steps to configure.

Monitor Azure Functions

Well, here we will discuss How to monitor Azure Functions. We must always have the option to monitor your Azure Functions. Azure Function provides an excellent option to integrate your Azure Function with the Azure Monitor logs.

If you try to understand the Azure Monitor Logs, Azure Monitor Logs is a feature of the Azure Monitor that collects from different sources, and you can analyze those data whenever needed.

Another important thing is Azure Monitor Logs is based on the Azure Data Explorer. You must query the Log details using the Kusto Query Language (KQL). Azure Monitor Logs collects the data and stores it in a Log Analytics workspace that consists of multiple tables, and each table contains the log data from a specific source.

Depending on your requirement, either you can use a single workspace, or you can use multiple workspaces for your Log data. You can also configure to store the Application Insights log data in the Azure Monitor logs. Multiple Applications can also use the same workspace.

You can use the Log Analytics Tool in the Azure Portal to interactively analyze the logs.

How To Configure Azure Monitor Logs For The Azure Function

You can follow the below steps to configure Azure Monitor Logs For the Azure Function. But the first thing we need is to create a Log Analytics workspace for configuring the Log Analytics workspace.

Create a Log Analytics workspace in the Azure portal

Follow the below steps to create a Log Analytics workspace in the Azure portal.

  1. Log in to the Azure Portal (https://portal.azure.com/)
  2. Once you log in to the Azure Portal, search for the Log Analytics workspace and click on the search result
functionapplogs

3. Now, on the Log Analytics workspaces page, click the + Add button.

monitor azure functions

4. On the Create Log Analytics Workspace, Provide the below details

  • Subscription: Choose your correct subscription
  • Resource group: Select your existing Resource group. If you don’t have any existing Resource Group, click on the Create new link to create the Resource group.
  • Name: Provide a unique name.
  • Region: Choose the location for the Log Analytics Workspace.

You can keep the other tabs option as default and click the Review + Create button.

Azure Function Monitor

5. Now, on the next screen, It will validate the Information Provided by you and show you the Validation passed, and then you click on the create button to create the Log Analytics workspace.

azure function console

6. Now, it will show you that Your deployment is complete. Click the Go to Resource button to see the Log Analytics Workspace you created.

azure functions logging without application insights

You can see below the Log Analytics Workspace that we have created just now

How To Monitor Azure Functions

Configure Azure Monitor Logs For The Azure Function

Now that our Log Analytics workspace is ready, We need to configure the Azure Monitor Logs.

  1. Log in to the Azure Portal (https://portal.azure.com/)
  2. Navigate to the Azure Function App for the one you want to configure the Azure Monitor Logs
functions monitoring

3. The next step is to click on the Diagnostic settings (Preview) option and then click on the + Add diagnostic setting as highlighted below.

azure function monitor

4. On the Diagnostics setting page, Provide a name for the Diagnostic settings, then select the FunctionAppLogs and Send to Log Analytics option. Once you select the Send