Skip to content

Commit e872aa0

Browse files
committed
View AKS container data in real time
1 parent 2c6255a commit e872aa0

File tree

6 files changed

+96
-2
lines changed

6 files changed

+96
-2
lines changed

articles/aks/TOC.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@
683683
href: control-plane-metrics-default-list.md
684684
- name: View the kubelet logs
685685
href: kubelet-logs.md
686-
- name: View container data real-time
687-
href: ../azure-monitor/containers/container-insights-livedata-overview.md?toc=/azure/aks/toc.json&bc=/azure/aks/breadcrumb/toc.json
686+
- name: View container data in real time
687+
href: container-insights-live-data.md
688688
- name: Cost analysis
689689
items:
690690
- name: Enable cost analysis on your cluster
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: View Azure Kubernetes Service (AKS) container logs, events, and pod metrics in real time
3+
description: Learn how to view Azure Kubernetes Service (AKS) container logs, events, and pod metrics in real time using Container Insights.
4+
author: schaffererin
5+
ms.service: azure-kubernetes-service
6+
ms.topic: how-to
7+
ms.author: schaffererin
8+
ms.date: 11/01/2023
9+
---
10+
11+
# View Azure Kubernetes Service (AKS) container logs, events, and pod metrics in real time
12+
13+
In this article, you learn how to use the *live data* feature in Container Insights to view Azure Kubernetes Service (AKS) container logs, events, and pod metrics in real time. This feature provides direct access to `kubectl logs -c`, `kubectl get` events, and `kubectl top pods` to help you troubleshoot issues in real time.
14+
15+
> [!NOTE]
16+
> AKS uses [Kubernetes cluster-level logging architectures](https://kubernetes.io/docs/concepts/cluster-administration/logging/#cluster-level-logging-architectures). The container logs are located inside `/var/log/containers` on the node. To access a node, see [Connect to Azure Kubernetes Service (AKS) cluster nodes](../../aks/node-access.md).
17+
18+
## Before you begin
19+
20+
For help with setting up the *live data* feature, see the [setup guide](container-insights-livedata-setup.md). This feature directly accesses the Kubernetes API. For more information about the authentication model, see [Kubernetes API](https://kubernetes.io/docs/concepts/overview/kubernetes-api/).
21+
22+
## View AKS resource live logs
23+
24+
> [!NOTE]
25+
> To access logs from a private cluster, you need to be on a machine on the same private network as the cluster.
26+
27+
1. In the [Azure portal][azure-portal], navigate to your AKS cluster.
28+
2. Under **Kubernetes resources**, select **Workloads**.
29+
3. Select the *Deployment*, *Pod*, *Replica Set*, *Stateful Set*, *Job* or *Cron Job* that you want to view logs for, and then select **Live Logs**.
30+
4. Select the resource you want to view logs for.
31+
32+
The following example shows the logs for a *Pod* resource:
33+
34+
:::image type="content" source="./media/container-insights-live-data/live-data-deployment.png" alt-text="Screenshot that shows the deployment of live logs." lightbox="./media/container-insights-live-data/live-data-deployment.png":::
35+
36+
## View live logs
37+
38+
You can view real time log data as it's generated by the container engine on the *Cluster*, *Nodes*, *Controllers*, or *Containers*.
39+
40+
1. In the [Azure portal][azure-portal], navigate to your AKS cluster.
41+
2. Under **Monitoring**, select **Insights**.
42+
3. Select the *Cluster*, *Nodes*, *Controllers*, or *Containers* tab, and then select the object you want to view logs for.
43+
4. On the resource **Overview**, select **Live Logs**.
44+
45+
> [!NOTE]
46+
> To view the data from your Log Analytics workspace, select **View Logs in Log Analytics**. To learn more about viewing historical logs, events, and metrics, see [How to query logs from Container Insights](container-insights-log-query.md).
47+
48+
After successful authentication, if data can be retrieved, it begins streaming to the Live Logs tab. You can view log data here in a continuous stream. The following image shows the logs for a *Container* resource:
49+
50+
:::image type="content" source="./media/container-insights-live-data/container-live-logs.png" alt-text="Screenshot that shows the container Live Logs view data option." lightbox="./media/container-insights-live-data/container-live-logs.png":::
51+
52+
## View live events
53+
54+
You can view real-time event data as it's generated by the container engine on the *Cluster*, *Nodes*, *Controllers*, or *Containers*.
55+
56+
1. In the [Azure portal][azure-portal], navigate to your AKS cluster.
57+
2. Under **Monitoring**, select **Insights**.
58+
3. Select the *Cluster*, *Nodes*, *Controllers*, or *Containers* tab, and then select the object you want to view events for.
59+
4. On the resource **Overview** page, select **Live Events**.
60+
61+
> [!NOTE]
62+
> To view the data from your Log Analytics workspace, select **View Events in Log Analytics**. To learn more about viewing historical logs, events, and metrics, see [How to query logs from Container Insights](container-insights-log-query.md).
63+
64+
After successful authentication, if data can be retrieved, it begins streaming to the Live Events tab. The following image shows the events for a *Container* resource:
65+
66+
:::image type="content" source="./media/container-insights-live-data/container-live-events.png" alt-text="Screenshot that shows the container Live Events view data option." lightbox="./media/container-insights-live-data/container-live-events.png":::
67+
68+
## View metrics
69+
70+
You can view real-time metrics data as it's generated by the container engine on the *Nodes* or *Controllers* by selecting a *Pod* resource.
71+
72+
1. In the [Azure portal][azure-portal], navigate to your AKS cluster.
73+
2. Under **Monitoring**, select **Insights**.
74+
3. Select the *Nodes* or *Controllers* tab, and then select the *Pod* object you want to view metrics for.
75+
4. On the resource **Overview** page, select **Live Metrics**.
76+
77+
> [!NOTE]
78+
> To view the data from your Log Analytics workspace, select **View Events in Log Analytics**. To learn more about viewing historical logs, events, and metrics, see [How to query logs from Container Insights](container-insights-log-query.md).
79+
80+
After successful authentication, if data can be retrieved, it begins streaming to the Live Metrics tab. The following image shows the metrics for a *Pod* resource:
81+
82+
:::image type="content" source="./media/container-insights-live-data/pod-live-metrics.png" alt-text="Screenshot that shows the pod Live Metrics view data option." lightbox="./media/container-insights-live-data/pod-live-metrics.png":::
83+
84+
## Next steps
85+
86+
For more information about monitoring on AKS, see the following articles:
87+
88+
* [Azure Kubernetes Service (AKS) diagnose and solve problems][aks-diagnose-solve-problems]
89+
* [Monitor Kubernetes events for troubleshooting][aks-monitor-events]
90+
91+
<!-- LINKS -->
92+
[azure-portal]: https://portal.azure.com/
93+
[aks-diagnose-solve-problems]: ./aks-diagnostics.md
94+
[aks-monitor-events]: ./events.md
43.3 KB
Loading
50.6 KB
Loading
45.4 KB
Loading
39.4 KB
Loading

0 commit comments

Comments
 (0)