3

We can access pod related logs from Log Analytics Workspace but there are no app logs (similar to what we see in kubectl get events).

I was referring the Azure documentation but I am still unable to access Application Pod logs from Azure Portal

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
Srinivas Bandaru
  • 311
  • 1
  • 4
  • 16

1 Answers1

9

In the portal part you have to go to the Kubernetes Services --> Monitoring --> Logs.

In this part, you have to query what you want. Similar to kubectl but in kusto query language.

Then you can try this query:

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

I found this and tried it and it works. More information on this page if you want to take a look.

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

Matthias Güntert
  • 4,013
  • 6
  • 41
  • 89