Application logs

更新时间:
复制 MD 格式

Compute Nest collects application logs from Elastic Compute Service (ECS) instances and Alibaba Cloud Container Service for Kubernetes (ACK) clusters in private or fully managed mode. This topic describes how to configure log collection for each mode.

Description

Application log management in Compute Nest provides the following benefits:

  1. Centralized collection and management of application logs across service instances, improving log processing consistency and convenience.

  2. Simplified log retrieval for PaaS software deployed across multiple hosts in a distributed environment, reducing the complexity of log collection configuration.

  3. Support for multiple deployment modes to meet different requirements:

    • Deployment modes for fully managed services: single-tenant ECS instance, single-tenant ACK cluster, and multi-tenant ACK cluster.

    • Deployment modes for private services: single-tenant ECS instance and single-tenant ACK cluster.

    For more information, see Overview.

  4. In fully managed mode, logs belong to the service provider. The service provider can monitor all tenant service instances and authorize tenants to view the logs of their own instances.

  5. In private mode, logs belong to the customer. The customer can view logs and authorize the service provider to manage the service instance.

Terms

  • application log in fully managed mode: Resources within a service instance belong to the service provider, so the logs also belong to the service provider.

  • application log in private mode: Resources within a service instance belong to the customer, so the logs also belong to the customer.

  • Compute Nest pseudo parameter: A placeholder added to a Resource Orchestration Service (ROS) template that Compute Nest dynamically replaces with a specific value when a customer creates a service instance. This feature is mainly used in ACK-based deployment mode. The format is {{ pseudo parameter }}, with one space before and after the parameter name within double braces ({{ }}). The following pseudo parameters are used in application log management:

    • {{ serviceId }}: Replaced with the unique ID of the service during deployment.

    • {{ serviceInstanceId }}: Replaced with the unique ID of the service instance during deployment.

    • {{ aliUid }}: Replaced with the ID of the Alibaba Cloud account used to deploy the service instance.

    • {{ serviceSls.LogProject }}: Replaced with the name of the Simple Log Service (SLS) project in the deployment region. This pseudo parameter is used only in fully managed services deployed on ACK clusters.

      • For example, if Project Log-BJ is configured in the China (Beijing) region and Project Log-SH in the China (Shanghai) region, a service instance deployed in China (Beijing) automatically collects logs to Project Log-BJ owned by the service provider.

    • {{ serviceSls.${key}.Logstore }}: Replaced with the name of the Logstore specified by the service provider for storing logs identified by ${key}. This pseudo parameter must be used together with the following two pseudo parameters. The three pseudo parameters with the same ${key} value belong to the same configuration set.

    • {{ serviceSls.${key}.LogPath }}: Replaced with the application log path specified by the service provider based on the selected region and the value of ${key}.

    • {{ serviceSls.${key}.LogFilePattern }}: Replaced with the application log file name pattern specified by the service provider based on the selected region and the value of ${key}.

ROS shared module for log collection: A reusable component provided by Compute Nest to collect logs from ECS instances. You can copy the module code directly into your template. This module is used in fully managed services deployed on ECS instances.

Log collection modes

Compute Nest supports the following log collection modes:

  • Simple mode: Collects logs line by line. Each line is treated as a single log entry.

  • Custom mode: For log formats not covered by simple mode, you can modify log collection configurations in the SLS console. Perform the following steps:

    1. Log on to the SLS console. Find the log collection configuration on the Logtail Configuration page of the specified Logstore in the specified project.logtail.webp

    2. Click the name of the configuration and enter a regular expression based on your business requirements.

      1723540494174-c9d37aa1-a7e9-4778-8568-f4d97bb8aad4.webp