0

我正在尝试将日志从 Azure Functions 提供给 AppInsight,类似于:

 log.LogInformation($"C# function processed: {myQueueItem}");

这实际上为我提供了 AppInsights 中的自定义维度属性。有没有办法使用 PowerShell 做类似的事情?

是否有更简单的方法将 Azure Function 数据记录到 AppInsights?

4

1 回答 1

0

可用于 PowerShell 函数的日志记录使用 PowerShell 中已有的各种流。INFORMATION除非您专门使用警告或错误流,否则大多数输出​​都会记录为。

https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell?tabs=portal#logging

或者,您可以使用以下要点自己实现一些东西:https ://gist.github.com/taddison/d49bd8c6f7fc1d45aa8e7b0906c180ae

这将允许您将自定义指标导出为对象。

于 2021-07-28T08:42:38.717 回答