Skip to content

Latest commit

 

History

History
151 lines (98 loc) · 7.92 KB

File metadata and controls

151 lines (98 loc) · 7.92 KB
title Monitor Azure Functions
description Start here to learn how to monitor Azure Functions.
ms.date 12/08/2025
ms.custom horz-monitor
ms.topic concept-article
ms.service azure-functions

Monitor Azure Functions

[!INCLUDE horz-monitor-intro]

[!INCLUDE horz-monitor-insights]

Application Insights

Azure Functions has built-in integration with Application Insights to monitor function executions. For detailed information about how to integrate, configure, and use Application Insights to monitor Azure Functions, see the following articles:

[!INCLUDE horz-monitor-resource-types] For more information about the resource types for Azure Functions, see Azure Functions monitoring data reference.

[!INCLUDE horz-monitor-data-storage]

[!INCLUDE horz-monitor-platform-metrics] For a list of available metrics for Azure Functions, see Azure Functions monitoring data reference.

Note

App Service metrics (Microsoft.Web/sites) aren't available when your function app runs on Linux in a Consumption plan.

[!INCLUDE horz-monitor-resource-logs]

Azure Functions integrates with Azure Monitor Logs to monitor functions. For detailed instructions on how to set up diagnostic settings to configure and route resource logs, see Create diagnostic settings in Azure Monitor.

:::image type="content" source="media/monitor-functions/choose-table.png" alt-text="Screenshot of adding a diagnostic setting for Azure Functions.":::

For the available resource log categories, their associated Log Analytics tables, and the logs schemas for Azure Functions, see Azure Functions monitoring data reference.

Important

Application Insights processes telemetry in batches. When a batch payload is too large or contains unescaped special characters, log entries might be dropped. To help prevent data loss:

  • Limit individual log messages to 10,000 characters, especially when you log large XML or JSON payloads.
  • Escape special characters in log data.
  • Summarize or truncate large payloads before you log them.

[!INCLUDE horz-monitor-activity-log]

Other logs

Azure Functions also offers the ability to collect more than Azure Monitor resource logs. To view a near real time stream of application log files generated by your function running in Azure, you can connect to Application Insights and use Live Metrics Stream. Or, you can use the App Service platform built-in log streaming to view a stream of application log files. For more information, see Enable streaming execution logs in Azure Functions.

[!INCLUDE horz-monitor-analyze-data]

[!INCLUDE horz-monitor-external-tools]

Analyze metrics for Azure Functions

Functions provides these two dynamic scale plans that support serverless hosting:

[!INCLUDE functions-consumption-plans-compare-tabs]

[!INCLUDE functions-monitor-metrics-consumption]

To learn more about estimating costs for these plans, see Estimating consumption plan costs.

Analyze logs for Azure Functions

Azure Functions writes all logs to the FunctionAppLogs table under LogManagement in the Log Analytics workspace where you send the data. You can use Kusto queries to query the data.

:::image type="content" source="media/monitor-functions/querying.png" alt-text="Screenshot of the Query window for Azure Functions in a Log Analytics workspace.":::

[!INCLUDE horz-monitor-kusto-queries]

The following sample queries can help you monitor all your functions app logs:

FunctionAppLogs
| order by TimeGenerated desc
FunctionAppLogs
| project TimeGenerated, HostInstanceId, Message, _ResourceId
| order by TimeGenerated desc

The following sample query can help you monitor a specific functions app's logs:

FunctionAppLogs
| where FunctionName == "<Function name>" 
| order by TimeGenerated desc

The following sample query can help you monitor exceptions on all your functions app logs:

FunctionAppLogs
| where ExceptionDetails != ""  
| order by TimeGenerated asc

The following sample query can help you monitor exceptions on a specific functions app's logs:

FunctionAppLogs
| where ExceptionDetails != ""  
| where FunctionName == "<Function name>" 
| order by TimeGenerated desc

[!INCLUDE horz-monitor-alerts]

[!INCLUDE horz-monitor-insights-alerts]

Azure Functions alert rules

The following table lists common and recommended alert rules for Azure Functions. These alerts are just recommendations. You can set alerts for any metric, log entry, or activity log entry listed in the Monitoring data reference for Azure Functions.

Alert type Condition Description
Metric Average connections When number of connections exceed a set value
Metric HTTP 404 When HTTP 404 responses exceed a set value
Metric HTTP Server Errors When HTTP 5xx errors exceed a set value
Activity Log Create or update function app When app is created or updated
Activity Log Delete function app When app is deleted
Activity Log Restart function app When app is restarted
Activity Log Stop function app When app is stopped

[!INCLUDE horz-monitor-advisor-recommendations]

Related content

For more information about monitoring Azure Functions, see the following articles: