【发布时间】:2020-01-22 19:54:49
【问题描述】:
我们可以从 Log Analytics Workspace 访问 pod 相关日志,但没有应用日志(类似于我们在 kubectl get events 中看到的)。
我指的是 Azure 文档,但我仍然无法从 Azure 门户访问 Application Pod 日志
【问题讨论】:
标签: azure-aks azure-log-analytics
我们可以从 Log Analytics Workspace 访问 pod 相关日志,但没有应用日志(类似于我们在 kubectl get events 中看到的)。
我指的是 Azure 文档,但我仍然无法从 Azure 门户访问 Application Pod 日志
【问题讨论】:
标签: azure-aks azure-log-analytics
在门户部分,您必须转到 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
我找到了这个并尝试了它并且它有效。如果您想查看更多信息,请访问此页面。
【讨论】: