All Products
Search
Document Center

Enterprise Distributed Application Service:Configure log collection

Last Updated:Nov 28, 2023

When you create or deploy an application in a Container Service for Kubernetes (ACK) cluster, you can configure log collection to allow Enterprise Distributed Application Service (EDAS) to deliver business logs and container standard output (stdout) and standard error (stderr) logs to Log Service. In Log Service, you can view the delivered logs without limits on the number of lines and implement automatic aggregation and analysis on these logs. This topic describes how to configure log collection.

Prerequisites

    1. Log Service is activated. For more information, see Log Service.
    2. The Log Service component, Logtail, is installed. For more information, see Collect log data from containers by using Log Service.
    Important You must activate Log Service before installing Logtail to avoid failures.
  • A 0.25-core CPU and 250 MB of memory are reserved for each instance in your application.

Configure log collection when you create an application

  1. Log on to the EDAS console. In the left-side navigation pane, choose Application Management > Applications. The Applications page appears. In the top navigation bar, select a region. In the upper part of the page, select a namespace. In the upper-left corner, click Create Application.

  2. In the Basic Information step, specify Cluster Type and Application Runtime Environment and click Next. The following table describes the parameters.

    Parameter

    Description

    Cluster Type

    The type of the cluster in which you want to deploy the application. Select Kubernetes Clusters.

    Application Runtime Environment

    The application runtime environment. Select an application runtime environment based on the type of the hosted application.

    • Java

      • Custom: Select this option if you want to use a custom image to deploy the application in a Kubernetes cluster.

      • Java: Select this option if you want to use a universal JAR package to deploy the application as a Dubbo or a Spring Boot application. You can set the Java Environment parameter after you select this option.

      • Tomcat: Select this option if you want to use a universal WAR package to deploy the application as a Dubbo or a Spring application. You can set the Java Environment and Container Version parameters after you select this option.

      • EDAS-Container (HSF): Select this option if you want to use a WAR or FatJar package to deploy the application as a High-speed Service Framework (HSF) application. You can set the Java Environment, Pandora Version, and Ali-Tomcat Version parameters after you select this option.

    • PHP: Select this option if the application is a PHP application that runs on Apache HTTP Server.

    • Node.js, C++, Go, and Other Languages: Select this option if you want to use a custom image to deploy the application in a Kubernetes cluster. The configuration process for multi-language applications is not described in this topic.

  3. In the Configurations step, configure the environment information, basic information, and deployment method for the application, set the related resource parameters, and then click Next.

  4. In the Advanced Settings step, click Log Collection Settings, turn on Enable log collection to SLS, and then set the parameters based on your business requirements.
    Configure log collection
    ParameterDescription
    Logstore NameEnter the name of the Logstore to receive logs. If the Logstore does not exist, a Logstore with the specified name is created.
    Collection Log TypeYou can select File Logs (Log Path in Container) or Standard Output Logs of Container.
    Collection PathEnter the storage path of logs in the container. Example:/usr/local/tomcat/logs/catalina.*.log
    Important
    • The specified storage path of logs must contain the log file name. Example: /tmp0/cjsc.log.
    • Do not store other important files in the directory where the log file is stored. Otherwise, your files may be overwritten.
    • To configure multiple collection rules, click Add Log Source.
  5. Click Create Application.

  6. On the Creation Completed page, check the information in the Basic Information, Configurations, and Advanced Settings sections. Then, click Create Application.

    In the upper part of the Application Overview page, click View Details. On the Change List page, view the application change process. Wait several minutes until the application is deployed. After the application change process is complete, view the status of the instance in the Basic Information section of the Application Overview page. If the status shows that a pod is running, the application is deployed.

Configure log collection when you deploy an application

If you did not configure log collection when you created an application, you can configure the relevant settings when you deploy the application.

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, click Application Management > Applications. In the top navigation bar, select a region. In the upper part of the page, select a namespace. Select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list. Then, find the application that you want to deploy and click the application name.

  3. On the Overview or Basic information page, choose Deploy > Deploy in the upper-right corner.

  4. On the Select Deployment Mode page, select a deployment mode and click Start Deployment in the upper-right corner of the specified deployment mode section.

  5. Configure the application environment and deployment package information. In the Advanced Settings step, click Log Collection Settings, turn on Enable log collection to SLS, set the parameters based on your business requirements, and then click OK.
    Configure log collection
    ParameterDescription
    Logstore NameEnter the name of the Logstore to receive logs. If the Logstore does not exist, a Logstore with the specified name is created.
    Collection Log TypeYou can select File Logs (Log Path in Container) or Standard Output Logs of Container.
    Collection PathEnter the storage path of logs in the container. Example:/usr/local/tomcat/logs/catalina.*.log
    Important
    • The application is restarted after you click OK. We recommend that you perform this operation during off-peak hours.
    • The specified storage path of logs must contain the log file name. Example: /tmp0/cjsc.log.
    • Do not store other important files in the directory where the log file is stored. Otherwise, your files may be overwritten.

Verify the result

After an application is deployed, EDAS collects and delivers logs to the specified Logstore based on the configured log collection rule.

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, click Application Management > Applications. In the top navigation bar, select a region. In the upper part of the page, select a namespace. Select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list. Then, find the application that you want to deploy and click the application name.

  3. In the left-side navigation pane, click Logs. On the page that appears, click the File Logs tab.
    On the File Logs tab, view the collected logs. If specific logs are displayed on the tab, the configured log collection rule is valid.
    • You can click Go in the Actions column to query and analyze logs in the Log Service console. For more information, see Index and Query.
    • You can also click Manage Log Source to manage log collection rules. In the Manage Log Source dialog box, modify the LogStore Name parameter and create or delete log collection rules as required.

FAQ

  • Does the logging feature of EDAS support log rotation?

    Yes. EDAS allows you to rotate logs by using wildcards.

    You need to specify the name of the log file to be collected. The name is case-sensitive and can contain wildcards. For example, you can specify *.log.

    The supported file name wildcards in Linux are asterisks (*), question marks (?), and [...].

  • What can I do if no data appears in the Log Service console when I query logs?

    Log Service returns the query results of the last 15 minutes by default and does not collect the logs that are generated before log collection is configured. If no data appears in the Log Service console, we recommend that you use a webshell to check whether logs are generated for your application.

    • If logs are generated, submit a ticket.
    • If no logs are generated, check your application.

DingTalk group for ACK and Serverless Kubernetes clusters in EDAS

If you have questions or suggestions when you use Container Service for Kubernetes (ACK) and Serverless Kubernetes clusters in EDAS, submit a ticket. To give feedback, you can also join the DingTalk group by searching for the DingTalk group ID 23197114.