Container Service for Kubernetes (ACK) integrates with Simple Log Service, which allows you to collect the access logs of data-plane clusters of a Service Mesh (ASM) instance. This topic describes how to enable and configure log collection and view the collected logs.
Background information
After you add a Kubernetes cluster to an ASM instance, Envoy proxies that are deployed on the data plane of the ASM instance can print all access logs of the cluster. For more information, see Access logging. You can run the kubectl logs command to view the Envoy access logs. Simple Log Service allows you to view logs in a convenient manner. In addition, you can collect and retrieve logs and create log dashboards.
Prerequisites
An ASM instance is created. For more information, see Create an ASM instance.
Step 1: Install Logtail for the Kubernetes cluster
Perform the following steps if a Kubernetes cluster is created
Log on to the ACK console.
In the left-side navigation pane of the ACK console, click Clusters.
On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
In the left-side navigation pane, choose .
On the Add-ons page, search for logtail-ds, and then click Install in the logtail-ds card.
In the Install logtail-ds dialog box, click OK.
The version of logtail-ds must be 0.16.24.0 or later. For more information about how to upgrade the version of logtail-ds, see Manage components.
Add the Kubernetes cluster to the ASM instance. For more information, see Add a cluster to an ASM instance.
Perform the following steps if no Kubernetes cluster is created
Log on to the ACK console.
In the left-side navigation pane of the ACK console, click Clusters.
In the upper-right corner of the Clusters page, click Create Kubernetes Cluster. For more information, see Create a managed Kubernetes cluster.
In the Log Service section of the Component Configurations step, select Enable Log Service to install Logtail for the Kubernetes cluster to be created.
Select Project: If you select this option, you must select an existing project to manage collected logs.
Create Project: If you select this option, the system automatically creates a project with a name in the format of
k8s-log-{ClusterID}
. ClusterID indicates the unique ID of the cluster to be created.
After the configuration is complete, click Create Cluster.
Add the Kubernetes cluster to the ASM instance. For more information, see Add a cluster to an ASM instance.
Step 2: Configure log collection
To use Logtail to collect Envoy access logs, you must configure log collection.
For ASM instances whose versions are 1.17.2.35 or later
Log on to the ASM console. In the left-side navigation pane, choose .
On the Mesh Management page, click the name of the instance that you want to manage. In the left-side navigation pane, choose .
On the Log Center page, choose
or choose , specify the log storage duration, and then click Enable Sidecar Log Collection. In the Submit message, click OK.
For ASM instances whose versions are earlier than 1.17.2.35
Log on to the ASM console. In the left-side navigation pane, choose .
On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
On the Base Information page, click Settings. On the panel that appears, select Collect access logs to Alibaba Cloud Log Service, and then click OK.
Step 3: View logs
After you configure log collection, Logtail uses the specified project to collect Envoy access logs and stores the logs in the specified Logstore. To view the logs, perform the following steps:
Log on to the ASM console. In the left-side navigation pane, choose .
On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
On the Kubernetes Clusters page, find the desired cluster and click Detailed Logs or Monitoring Center in the Access Logs column.
If you click Detailed Logs, you can view original access logs in a sorted manner.
If you click Monitoring Center, you can view multi-dimensional statistics on access logs.