Azure Kubernetes (AKS) Events with Azure Log Analytics

Thirumurthi
2 min readJan 18, 2022

--

Assumption:

The Azure Kubernetes Service is already set, with the Log Analytics enabled.

Information:

The AKS containers doesn’t persist the events within, those are shipped to the Log Analytics Workspace.

From portal, navigate to Log Analytics Workspace and select configured workspace.

1. From workspace left menu blade, select Logs option

2. From the Queries listed, select the Containers option, pick the Kubernetes Events and click the run button

3. Once the Query editor is opened up, include the query below and the result provides the list of events over time.

// Kubernetes events 
// Lists all the Kubernetes events.
KubeEvents
| where TimeGenerated > ago(2d)
| where not(isempty(Namespace))
| where Namespace contains "namespace-of-aks-to-fetch-event"
| where Name contains "pod-name" //pod or deployment name
| top 200 by TimeGenerated desc

The query can be tweaked per requirement. The above approach summarizes how to view the Kubernetes container events in AKS LogAnalytics workspace.

--

--