Error setting up Azure Function within Azure Resource under Log Analytics Workspace

1.2k Views Asked by At

I have error setting up Azure Function within Azure Resource under Log Analytics Workspace.

When only AllMetrics is checked, it works. But whenever FunctionExecutionLogs is checked, error occurs like below:

enter image description here

1.Nav to your log analytics workspace in azure portal.

2.in the left blade, select Workspace Data Sources -> Azure Resources, then click your azure function there.

  1. Check FunctionExecutionLogs and error occurs.

Any idea?

Setup data used by Azure Log Analytics with Azure Fucntions

Update

We would like to understand more on Application InSights and Log Analytics, and use the best tool for us.

3

There are 3 best solutions below

1
On BEST ANSWER

'FunctionExecutionLogs' for azure function/web app in azure log analytics will not be supported any more.

So application insights is a better choice for monitoring azure function.

The following is the feedback from MS log analytics team:

Several months ago, App Service/Functions team on-boarded to Azure Monitor diagnostic logs but they don't actually emit log data.

Basically there are thousands of diagnostic setting registrations which are no-ops and don't actually do anything.

Recently in the past few weeks, we've been in discussion with App Service to release this feature in the next few weeks as a private preview feature.

This unfortunately is a breaking change as only private preview customers can turn on diagnostic logs for App Service. Please note -- There is no actual customer impact as whatever customers turned on previously never worked to begin with.

To fix the deployment script, we should ask customers to update their template to only turn on metric export and not logs --- this won't have any actual customer impact.

So, from our Log Analytics side, this is a scenario we are not support from our Log Analytics team which has declared by our Production Group any more.

1
On

I would recommend using Application insight with Azure Functions. Application insights has deeper integration with Azure Functions and is the recommended way of setting up Analytics for your app. Is there a specific reason you want to setup through Log Analytics instead of Application Insights?

0
On

Now, almost 2 years later, Classic Application Insights is deprecated (apparently it will be retired around Feb '24). The recommended way to set this up is to

  1. Create a log analytics workspace
  2. Create an application insights resource that has it's workspace id set to the LA workspace created in the previous step

Your functions will still be configured to log to app insights but that has its datastorage now backed by the LA workspace instead of bringing its own.

You can migrate existing app insights to link to a LA workspace - apparently this migration is not reversible but it should be transparent from your function point of view (i.e. the app insights connection doesn't change). Details can be found here: https://learn.microsoft.com/en-nz/azure/azure-monitor/app/convert-classic-resource