Azure Function App Logging

Admin (KK) 136 Reputation points
2023-04-21T20:33:07.4733333+00:00

Hello Team, I am using an Azure Function with Python. I am getting lot of logging when I am trying to authenticate with Service Principal and also writing the data to Event Hub (which is more of information logging) . For Example when writing the data to event hub, I am getting the following information/trace logging. Link state changed: <LinkState.DETACHED: 0> -> <LinkState.DETACHED: 0> Management link receiver state changed: <LinkState.DETACHED: 0> -> <LinkState.DETACHED: 0> Link state changed: <LinkState.DETACHED: 0> -> <LinkState.DETACHED: 0 when reading the blob from storage account , I am getting the following information / trace logging. Response status: 200
Response headers:
'Cache-Control': 'no-store, no-cache'
'Pragma': 'no-cache'
'Content-Type': 'application/json; charset=utf-8'
'Expires': '-1'
'Strict-Transport-Security': 'REDACTED'
'X-Content-Type-Options': 'REDACTED'
'P3P': 'REDACTED'
'client-request-id': 'REDACTED'
'x-ms-request-id': '90310a24-a0e5-45e8-ac5d-7d57905e3a00'
'x-ms-ests-server': 'REDACTED'
'x-ms-clitelem': 'REDACTED'
'X-XSS-Protection': 'REDACTED'
'Set-Cookie': 'REDACTED'
'Date': 'Fri, 21 Apr 2023 20:11:20 GMT'
'Content-Length': '1316'
Response status: 200
Response headers:
'Cache-Control': 'max-age=86400, private'
'Content-Type': 'application/json; charset=utf-8'
'Strict-Transport-Security': 'REDACTED'
'X-Content-Type-Options': 'REDACTED'
'Access-Control-Allow-Origin': 'REDACTED'
'Access-Control-Allow-Methods': 'REDACTED'
'P3P': 'REDACTED'
'x-ms-request-id': '1fd1f965-8d58-4931-8c2d-75e6c9481000'
'x-ms-ests-server': 'REDACTED'
'X-XSS-Protection': 'REDACTED'
'Set-Cookie': 'REDACTED'
'Date': 'Fri, 21 Apr 2023 20:11:20 GMT'
'Content-Length': '945'
Is there a way i can reduce the logging and get only the warning, errors and exception logging while executing the function app. Thanks

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,678 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,639 questions
Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
601 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ami Hollander 5 Reputation points Microsoft Employee
    2023-05-07T08:14:52.38+00:00

    You are able to configure azure function logging via host.json, and to tune logs for specific library as needed.
    For example,

    {
      "version": "2.0",
      "logging": {
        "logLevel": {
          "default": "Warning",
          "Function": "Warning",
          "Host.Results": "Warning",
          "Host.Aggregator": "Warning",
          "Azure.Core": "Error" // Example of configuring a specific library for error logs only
        }
        "applicationInsights": {
          "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request"
          }
        }
      },
      "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[3.*, 4.0.0)"
      },
      "functionTimeout": "-1"
    }
    

    more information can be found here

    1 person found this answer helpful.
    0 comments No comments