gpt4 book ai didi

Azure 日志分析严重性级别作为字符串

转载 作者:行者123 更新时间:2023-12-02 07:38:01 28 4
gpt4 key购买 nike

目前,在 azure 应用程序洞察中,我们在严重性级别下看到严重性级别的编号,而不是信息、错误等文本......是否可以将严重性级别显示为字符串。

enter image description here

"Serilog": {
"Using": [
"Serilog.Sinks.ApplicationInsights"
],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information"
}
},
"WriteTo": [
{
"Name": "ApplicationInsights",
"Args": {
"restrictedToMinimumLevel": "Information",
"telemetryConverter": "Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights",
"instrumentationKey": "key"
}
}
],
"Enrich": [
"FromLogContext"
],
"Properties": {
"Application": "Sample"
}
}

最佳答案

临时功能,使用 let声明

// Sample generation. Not part of the solution
let traces = materialize(range i from 1 to 10 step 1 | project severityLevel = toint(rand(5)), Timestamp = ago(rand()*1d));
// Solution starts here
let getSeverityDescription = (severityLevel:int)
{
dynamic(["Verbose", "Information", "Warning", "Error", "Critical"])[severityLevel]
};
traces
| extend SeverityDescription = getSeverityDescription(severityLevel)
<表类=“s-表”><标题>严重级别时间戳严重性描述 <正文>32022-06-29T11:56:30.3936027Z错误42022-06-29T15:08:45.0941469Z严重42022-06-30T03:02:29.1658275Z严重12022-06-30T03:29:22.4724933Z信息02022-06-30T04:01:15.7748102Z详细02022-06-30T04:37:39.740977Z详细22022-06-30T05:13:04.734582Z警告22022-06-30T07:32:01.9569582Z警告22022-06-30T07:41:46.3364296Z警告12022-06-30T09:42:22.5852665Z信息

Fiddle

关于Azure 日志分析严重性级别作为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72807485/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com