如何在Azure函数日志中排除请求日志条目?

huangapple go评论71阅读模式
英文:

How to exclude Request log entries in Azure Function logs?

问题

如何排除 Azure 函数应用程序日志输出中的 "Request" 日志条目?

这些条目似乎是由函数运行时自动生成的,而不是我手动创建或感兴趣的条目。它们似乎主要与 Blob 触发器的存储轮询等内容相关。我过去没有看到这些条目,但现在它们填满了我的日志,使我很难定位我感兴趣的日志。

我在我的 host.json 文件中有一些日志配置,但似乎没有改变任何内容。它看起来像下面这样...

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    },
    "logLevel": {
      "WhatInBoxFunctions": "Information"
    }
  }
}
英文:

How can I exclude the "Request" log entries in an Azure Function application's log output?

如何在Azure函数日志中排除请求日志条目?

These entries seem to be generated by the Function runtime itself and are not entries that I am creating manually or interested in seeing. They appear to be mostly related to Storage polling for Blob Triggers, etc. I used to not see these entries but now they're filling up my logs and make it hard to locate the logs that I am interested in.

I do have some logging configuration in my host.json file, but it does not appear to change anything. It looks like below ...

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    },
    "logLevel": {
      "WhatInBoxFunctions": "Information"
    }
  }
}

答案1

得分: 1

  • 感谢 @Delliganesh,我遵循了一些配置。

  • 正如您在上面的截图中提到的,应该忽略请求 ID 记录。

  • 对于日志条目和请求 ID,我已创建的函数应用在本地运行。

如何在Azure函数日志中排除请求日志条目?

如何在Azure函数日志中排除请求日志条目?

通过此方式排除的 请求类型,我可以在应用洞察日志中忽略请求 ID。

已更新的 host.json 模块:

{
    "version": "2.0",
    "logging": {
      "applicationInsights": {
        "samplingSettings": {
          "isEnabled": true,
          "excludedTypes": "Request"
        }
      },
      "logLevel": {
        "default": "Warning",
        "MyFunctionApp": "Information"
      }
    }
  }
  • 请检查以下的日志流:

如何在Azure函数日志中排除请求日志条目?

英文:
  • Thanks @Delliganesh, I followed some configuration.

  • As you mentioned in above screenshot that the request ID logs should be Ignored.

  • For logs entries and request id's I have created function app works locally.

如何在Azure函数日志中排除请求日志条目?

如何在Azure函数日志中排除请求日志条目?

Request type excluded by this I can able to Ignore request id's in App insight logs.

Updated host.json module:

{
    "version": "2.0",
    "logging": {
      "applicationInsights": {
        "samplingSettings": {
          "isEnabled": true,
          "excludedTypes": "Request"
        }
      },
      "logLevel": {
        "default": "Warning",
        "MyFunctionApp": "Information"
      }
    }
  }
  • check below for log stream:

如何在Azure函数日志中排除请求日志条目?

huangapple
  • 本文由 发表于 2023年7月14日 02:21:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76682255.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定