All Products
Search
Document Center

Alibaba Cloud Service Mesh:Use Simple Log Service to collect access logs on the data plane

Last Updated:Apr 03, 2024

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

  1. Log on to the ACK console.

  2. In the left-side navigation pane of the ACK console, click Clusters.

  3. 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.

  4. In the left-side navigation pane, choose Operations > Add-ons.

  5. On the Add-ons page, search for logtail-ds, and then click Install in the logtail-ds card.

  6. 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.

  7. 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

  1. Log on to the ACK console.

  2. In the left-side navigation pane of the ACK console, click Clusters.

  3. 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.开启日志1

    • 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.开启日志2

  4. After the configuration is complete, click Create Cluster.

  5. 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

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the instance that you want to manage. In the left-side navigation pane, choose Observability Management Center > Log Center.

  3. On the Log Center page, choose Data-Plane Logs > Sidecar Proxy Logs or choose Data-Plane Log Dashboard > Sidecar Proxy Dashboards, 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

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose ASM Instance > Base Information.

  3. 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:

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose Cluster & Workload Management > Kubernetes Clusters.

  3. 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.