作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用下面的查询调查 Azure 中的部署失败
AzureActivity
| where OperationNameValue endswith "XXXXXXXXXXX"
| where ActivityStatus in ("Failed")
| where CorrelationId == "XXXXXXXXXXXX"
| extend p = parse_json(Properties)
| project p
| evaluate bag_unpack(p)
我得到的结果(包含 statusMessage
列)具有非常高的嵌套级别,最重要的消息(显然)位于最内层。
"status": "Failed",
"error": {
"code": "ResourceOperationFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "ApplianceDeploymentFailed",
"message": "The operation to create appliance failed. Please check operations of deployment 'app' under resource group '/subscriptions/xxx/resourceGroups/yyy'. Error message: 'At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.'",
"details": [
{
"code": "Conflict",
"message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\",\r\n \"details\": [\r\n {\r\n \"code\": \"Conflict\",\r\n \"message\": \"{\\r\\n \\\"status\\\": \\\"Failed\\\",\\r\\n \\\"error\\\": {\\r\\n \\\"code\\\": \\\"ResourceDeploymentFailure\\\",\\r\\n \\\"message\\\": \\\"The resource operation completed with terminal provisioning state 'Failed'.\\\",\\r\\n \\\"details\\\": [\\r\\n {\\r\\n \\\"code\\\": \\\"DeploymentFailed\\\",\\r\\n \\\"message\\\": \\\"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\\\",\\r\\n \\\"details\\\": [\\r\\n {\\r\\n \\\"code\\\": \\\"Conflict\\\",\\r\\n \\\"message\\\": \\\"{\\\\r\\\\n \\\\\\\"status\\\\\\\": \\\\\\\"Failed\\\\\\\",\\\\r\\\\n \\\\\\\"error\\\\\\\": {\\\\r\\\\n \\\\\\\"code\\\\\\\": \\\\\\\"ResourceDeploymentFailure\\\\\\\",\\\\r\\\\n \\\\\\\"message\\\\\\\": \\\\\\\"The resource operation completed with terminal provisioning state 'Failed'.\\\\\\\",\\\\r\\\\n \\\\\\\"details\\\\\\\": [\\\\r\\\\n {\\\\r\\\\n \\\\\\\"code\\\\\\\": \\\\\\\"DeploymentFailed\\\\\\\",\\\\r\\\\n \\\\\\\"message\\\\\\\": \\\\\\\"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\\\\\\\",\\\\r\\\\n \\\\\\\"details\\\\\\\": [\\\\r\\\\n {\\\\r\\\\n \\\\\\\"code\\\\\\\": \\\\\\\"Conflict\\\\\\\",\\\\r\\\\n \\\\\\\"message\\\\\\\": \\\\\\\"{\\\\\\\\r\\\\\\\\n \\\\\\\\\\\\\\\"status\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"Failed\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n \\\\\\\\\\\\\\\"error\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n \\\\\\\\\\\\\\\"code\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"ResourceDeploymentFailure\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n \\\\\\\\\\\\\\\"message\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"The resource operation completed with terminal provisioning state 'Failed'.\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n \\\\\\\\\\\\\\\"details\\\\\\\\\\\\\\\": [\\\\\\\\r\\\\\\\\n {\\\\\\\\r\\\\\\\\n \\\\\\\\\\\\\\\"code\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"OSProvisioningInternalError\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n \\\\\\\\\\\\\\\"message\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"OS Provisioning failed for VM 'zzz' due to an internal error: [ProvisionError] cloud-init appears to be running, which is not expected, cannot continue.\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n }\\\\\\\\r\\\\\\\\n ]\\\\\\\\r\\\\\\\\n }\\\\\\\\r\\\\\\\\n}\\\\\\\"\\\\r\\\\n }\\\\r\\\\n ]\\\\r\\\\n }\\\\r\\\\n ]\\\\r\\\\n }\\\\r\\\\n}\\\"\\r\\n }\\r\\n ]\\r\\n }\\r\\n ]\\r\\n }\\r\\n}\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}"
}
]
}
]
}
}
我显然希望在一个级别上拥有所有错误和详细信息,并且响应中没有字符串化的 JSON。bag_unpack()
是执行此操作的合适工具吗?我可能缺少哪些设置?还有其他函数可以帮助解决这个问题吗?
最佳答案
由于您可以拥有无限数量的嵌套错误,因此最简单的方法是使用正则表达式来提取所有错误消息 extract_all() :
AzureActivity
| where OperationNameValue endswith "XXXXXXXXXXX"
| where ActivityStatus in ("Failed")
| where CorrelationId == "XXXXXXXXXXXX"
| extend Errors = extract_all('"message":"([^"]*)"', tostring(Properties))
关于azure - 是否可以在 Kusto 中使用 bag_unpack 解析 Azure LogAnalytics 中的无界 JSON 嵌套?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64506237/
我有一个Foldable的Integer s 是无界的,因此我无法应用 Max折叠到它。 定义 Max 有意义吗? Nothing 的实例当一个值不存在时?有Ord a => Semigroup (M
我有两个简单的问题。我有一个 LinkedBlockingQueue,我将其简单地创建为 新的 LinkedBlockingQueue() 所以我认为这保证是无限的,对吗? 如果确实如此,那么说在此队
是否可以在未指定边界之一的情况下使用 git bisect。例如,如果我发现 HEAD 上有问题但我怀疑它在过去在某个时候有效,有没有办法告诉 git “尝试一次提交之前,如果那不起作用尝试两次提交之
我是一名优秀的程序员,十分优秀!