gpt4 book ai didi

azure-aks - 来自 Azure 门户的 Pod 中运行的应用程序的 Azure AKS 应用程序日志?

转载 作者:行者123 更新时间:2023-12-01 21:48:30 29 4
gpt4 key购买 nike

我们可以从 Log Analytics Workspace 访问 pod 相关日志,但没有应用程序日志(类似于我们在 kubectl get events 中看到的)。

我指的是 Azure 文档,但我仍然无法从 Azure 门户访问应用程序 Pod 日志

最佳答案

在门户部分,您必须转到 Kubernetes 服务 --> 监控 --> 日志。

在这部分,您必须查询您想要的内容。类似于 kubectl,但使用 kusto 查询语言。

然后你可以试试这个查询:

let startTimestamp = ago(1h);
KubePodInventory
| where TimeGenerated > startTimestamp
| project ContainerID, PodName=Name
| distinct ContainerID, PodName
| join
(
ContainerLog
| where TimeGenerated > startTimestamp
)
on ContainerID
// at this point before the next pipe, columns from both tables are available to be "projected". Due to both
// tables having a "Name" column, we assign an alias as PodName to one column which we actually want
| project TimeGenerated, PodName, LogEntry, LogEntrySource
| order by TimeGenerated desc

我找到了这个并尝试了它并且有效。如果您想查看更多信息,请访问此页面。

https://blog.coffeeapplied.com/using-azure-monitor-logs-with-azure-kubernetes-service-aks-c0b0625295d1

关于azure-aks - 来自 Azure 门户的 Pod 中运行的应用程序的 Azure AKS 应用程序日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59867349/

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