5. View and query your Function app logs
In this article of the series, you view and query Azure Function app logs in the Azure portal.
Query your Azure Function logs
Use the Azure portal to view and query your function logs.
In VS Code, select the Azure logo to open the Azure Explorer, then under Functions, right-click on your function app, then select Open in Portal.
This opens the Azure portal to your Azure Function.
Select Application Insights from the Settings, then select View Application Insights data.
This link takes you to your separate metrics resource created for you when you created your Azure Function with VS Code.
Select Logs in the Monitoring section. If a Queries pop-up window appears, select the X in the top-right corner of the pop-up to close it.
In the Schema and Filter pane, on the Tables tab, double-click the traces table.
This enters the Kusto query,
tracesinto the query window.Edit the query to search for API calls:
traces | where message startswith "Executing "Select Run.
If the log doesn't display any results, it may be because there is a few minutes delay between the HTTP request to the Azure Function and the log availability in Kusto. Wait a few minutes and run the query again.
Because you added an Application Insights resource when you created the Azure Function app, you didn't need to do anything extra to get this logging information:
- The Function app added Application Insights for you.
- The Query tool is included in the Azure portal.
- You can click on
tracesinstead of having to learn to write a Kusto query to get even the minimum information from your logs.