Is there a solution if I have lost Azure Functions apps logs?

Dewa Tsukasa 60 Reputation points
2024-12-02T05:22:12.8733333+00:00

Hello Everyone.

I am using a BI tool to check Azure Functions apps logs, but am having problems with some data being missing.

I followed the instructions on the official page

https://learn.microsoft.com/en-us/troubleshoot/azure/azure-functions/monitoring/functions-monitoring-appinsightslogs#logs-are-missing-or-partial

and was told that I could adjust it in host.json, so I entered the following information:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": false
      },
      "enableLiveMetricsFilters": true
    },
    "logLevel": {
      "default": "Warning",
      "Function.Function1.User": "Information",
      "Function.Function2.User": "Information",
      "Function.Function3.User": "Information",
      "Host.Results": "Information"
    }
  },
  "concurrency": {
    "dynamicConcurrencyEnabled": true,
    "snapshotPersistenceEnabled": true
  },
  "functionTimeout": "00:00:20"
}

But data was still missing:

union requests,dependencies,pageViews,browserTimings,exceptions,traces
| where timestamp > todatetime("11/27/2024 15:00:00") and timestamp < todatetime("11/28/2024 14:59:59")
| summarize TelemetrySavedPercentage = 100/avg(itemCount), TelemetryDroppedPercentage = 100-100/avg(itemCount) by bin(timestamp, 1h), itemType
| sort by timestamp asc

query_data.csv.txt

The solution I looked into was to set the maxTelemetryItemsPerSecond value in host.json to a large value such as 100 (the default value is 20), but I'm not sure if that really solves the problem.

Please tell me how to solve this problem.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,363 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,185 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pinaki Ghatak 5,230 Reputation points Microsoft Employee
    2024-12-03T09:53:54.1+00:00

    Hi @Dewa Tsukasa

    Before adjusting the maxTelemetryItemsPerSecond value, I recommend checking a few things:

    1. Make sure that the logs you're looking for are within the retention period of your Application Insights instance. By default, logs are retained for 90 days, but this can be changed in the Application Insights settings.
    2. Check that the logs you're looking for are being sent to the correct Application Insights instance. You can check this by looking at the instrumentationKey value in your local.settings.json file or in the Application Insights settings.
    3. Verify that the logs you're looking for are being generated by your Azure Functions app. You can do this by checking the code for your app and making sure that logging statements are being used appropriately.

    If you've checked these things and are still experiencing missing logs, you can try adjusting the maxTelemetryItemsPerSecond value in the host.json file. However, keep in mind that increasing this value can increase the cost of your Application Insights instance.

    I hope this helps.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.