Data is there in the Log Analytics Workspace however not showing in the AppInsights?

Upkar Singh (TATA CONSULTANCY SERVICES LTD) 0 Reputation points Microsoft Vendor
2023-10-30T23:15:12.9966667+00:00

There is no data in the App Insights even when I monitor the function app however I can see the logs in the Live metrics data and the Log Analytics Workspace. Tried exploring but no luck.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,472 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,030 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 18,575 Reputation points Microsoft Employee
    2023-10-31T06:04:28.05+00:00

    @Upkar Singh (TATA CONSULTANCY SERVICES LTD) Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
    I understand that you are not seeing any data in the Application Insights. However you are able to see the logs in the Live metrics data and the Log Analytics Workspace.

    Here are some of the suggestions, which you can try:

    1. For a function app to send data to Application Insights, it needs to know the instrumentation key of an Application Insights resource. The key must be in an app setting named APPINSIGHTS_INSTRUMENTATIONKEY. Ensure that you have this setting.

    2.Ensure that you have the APP insights and logLevel related data in host.json as shown below:

    {
      "version": "2.0",
      "logging": {
        "logLevel": {
          "Host.Results": "Error",
          "Function": "Debug",
          "Host.Aggregator": "Trace"
        },
        "applicationInsights": {
          "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request"
          }
        }
      },
      "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[3.*, 4.0.0)"
      }
    }
    

    3.Ensure that you have the relevant logging added within your application code:

        logging.debug('This is a debug log.')
    
        logging.info('This is an info log')
    

    4.After having all the above settings, you should see the logs in APP insights as shown below:enter image description here

    5.Alternatively, you can also try checking the Monitor tab within the Function and clicking on the Logs tab:
    User's image

    6.You can also navigate to the APPInsights and Click on the Logs as shown below and query the logs:
    User's image

    User's image

    User's image

    Queries used:

    traces 
    | where timestamp >= ago(10d)
    
    requests
    | where timestamp >= ago(10d)
    

    Hope this helps.

    If the above action plan doesn't help. Please let me know. I would be happy to assist you further.

    **
    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments