Monitoring Azure Functions with Azure Monitor Logs

Azure Functions offers an integration with Azure Monitor Logs to monitor functions. This article shows you how to configure Azure Functions to send system-generated and user-generated logs to Azure Monitor Logs.

Azure Monitor Logs gives you the ability to consolidate logs from different resources in the same workspace, where it can be analyzed with queries to quickly retrieve, consolidate, and analyze collected data. You can create and test queries using Log Analytics in the Azure portal and then either directly analyze the data using these tools or save queries for use with visualizations or alert rules.

Azure Monitor uses a version of the Kusto query language used by Azure Data Explorer that is suitable for simple log queries but also includes advanced functionality such as aggregations, joins, and smart analytics. You can quickly learn the query language using multiple lessons.


Integration with Azure Monitor Logs is currently in public preview for function apps running on Windows Consumption, Premium, and Dedicated hosting plans.

Setting up

From the Monitoring section, select Diagnostic settings and then click Add diagnostic setting.

Add a diagnostic setting

In the Diagnostics settings page, choose Send to Log Analytics, and then select your Log Analytics workspace. Under log choose FunctionAppLogs, this table contains the desired logs.

Add a diagnostic setting

User-generated logs

To generate custom logs, you can use the specific logging statement depending on your language, here are sample code snippets:

log.LogInformation("My app logs here.");

Querying the logs

To query the generated logs, go to the Log Analytics workspace that you configured to send the function logs to and click Logs.

Query window in LA workspace

Azure Functions writes all logs to FunctionAppLogs table, here are some sample queries.

All logs

| order by TimeGenerated desc

A specific function logs

| where FunctionName == "<Function name>" 


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

Next steps