【问题标题】:Azure AKS application logs for the application running in Pod from Azure Portal?从 Azure 门户在 Pod 中运行的应用程序的 Azure AKS 应用程序日志?
【发布时间】:2020-01-22 19:54:49
【问题描述】:

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

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

【问题讨论】:

    标签: azure-aks azure-log-analytics


    【解决方案1】:

    在门户部分,您必须转到 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

    【讨论】:

      猜你喜欢
      • 2020-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多