All Products
Search
Document Center

Platform For AI:Configure Log Service for a resource group

Last Updated:Jun 11, 2026

You can configure Simple Log Service (SLS) for a resource group to collect logs from Elastic Algorithm Service (EAS) services in that resource group. These logs, which can include standard output and custom file logs, are stored in a destination SLS Logstore.

Prerequisites

Activate Simple Log Service (SLS) and create a project and a Logstore. For more information, see Use LoongCollector to collect and analyze text logs from ECS instances.

Step 1: Create a machine group

For public resource groups

For services deployed in a public resource group, you must create a machine group manually.

  1. Log on to the Simple Log Service console.

  2. In the Projects section, click the one you want.

    image

  3. In the left-side navigation pane, choose Resources > Machine Groups.

  4. On the right side of Machine Groups, choose 机器组 > Create Machine Group.

  5. Create a machine group by using a custom identifier.

    Important

    The dedicated custom identifier for EAS services has the format eas-log-group-{region_id}. For example, the custom identifier for the China (Zhangjiakou) region is eas-log-group-cn-zhangjiakou.

    In the Name field, enter eas-log-group-cn-zhangjiakou. Leave the Machine group topic field empty.

  6. After deploying a service, open the Machine Group Configuration page and check the instance heartbeat status. A status of OK indicates that the machine group is running properly.

    Note

    If no service is deployed, the instance list is empty.

For dedicated resource groups

For a dedicated resource group, you must enable log delivery to SLS in the PAI console.

  1. Log on to the PAI console. Select a region on the top of the page. Then, select the desired workspace and click Elastic Algorithm Service (EAS).

  2. On the Resource Group tab, click the resource group name to open the dedicated resource group details page.

  3. On the dedicated resource group details page, click Configure SLS.

  4. In the Configure Log Service Settings dialog box, select an SLSProject and a logstore, and then click OK.

    Parameter

    Description

    SLSProject

    A project is a resource management unit in Simple Log Service (SLS) for resource isolation and access control. If no project is available on the current page, click Create SLSProject to create one. For more information, see Manage a project.

    logstore

    A Logstore is a unit in Simple Log Service (SLS) used to collect, store, and query log data. If no Logstore is available, click Create Logstore to create one. For more information, see Create a basic LogStore.

    After you enable log delivery, SLS automatically creates a machine group named in the format eas-sls-{resource-id}-mg, for example, eas-sls-eas-r-9u2lq6ij1pk5yvvh****-mg. The resource-id is the resource group ID.

    In addition, EAS automatically creates a Logtail configuration in the specified Logstore to collect logs generated by the EAS framework.

For resource quotas

If you use a resource quota, create a machine group.

  1. Log on to the Simple Log Service console.

  2. In the Projects section, click the one you want.

    image

  3. In the left-side navigation pane, choose Resources > Machine Groups.

  4. On the right side of Machine Groups, choose 机器组 > Create Machine Group.

  5. Create a machine group by using a custom identifier.

    Important

    The custom identifier for a resource quota uses the format eas-log-group-{region_id}-for-resource-quota. For example, the custom identifier for the China (Zhangjiakou) region is eas-log-group-cn-zhangjiakou-for-resource-quota.

    In the machine group creation form, set both Name and User-defined ID to eas-log-group-cn-zhangjiakou-for-resource-quota, and for Machine group identifier, select User-defined ID.

  6. After deploying a service, open the Machine Group Configuration page and check the instance heartbeat status. A status of OK indicates that the machine group is running properly.

    Note

    If no service is deployed, the instance list is empty.

Step 2: Configure Logtail

You can configure Logtail to collect logs based on your requirements. This section describes how to perform two common configurations: collecting container standard output and collecting logs from files in containers. For more information about advanced configurations, see Collect host text logs.

For services in public and dedicated resource groups

Collect container standard output

  1. Log on to the Simple Log Service console.

  2. In the Import Data section, click K8s - Stdout and Stderr - Old Version.

  3. Select the target project and Logstore, and then click Next.

  4. Click Use Existing Machine Groups, select the machine group that you manually created in Step 1 for the public resource group or the one automatically created for the dedicated resource group, and then click Next.

  5. (Optional) If you are deploying a service with a custom image and want to exclude EAS engine logs, enable Container Filtering in the Input configuration section. Then, add an entry to the Container Label Blacklist. Set Label Name to io.kubernetes.container.name and Label Value to easworker.

  6. Click Next to complete the configuration.

Collect logs from files in containers

  1. In the Import Data section, click Kubernetes - File.

  2. Select the target project and Logstore, and then click Next.

  3. Click Use Existing Machine Groups, select the machine group that you manually created in Step 1 for the public resource group or the one automatically created for the dedicated resource group, and then click Next.

  4. On the Logtail Configurations wizard page, configure the parameters and click Next.

    In the Input configuration section, you must configure the File Path (the path of the files to collect). For information about other parameters, see Collect text logs from Kubernetes containers in DaemonSet mode.

  5. Click Next to complete the configuration.

For services that use resource quotas

Collect container standard output

  1. Log on to the Simple Log Service console.

  2. In the Import Data section, click Single Line - Text Logs.

    Note

    You can change the ingestion type based on your requirements. For example, if you need to match collected logs by using regular expressions, select Regular Expression - Text Logs. If you need to parse logs in JSON format, select JSON - Text Logs. You can also modify the configuration after it is created.

  3. For Usage Scenario, select Host Scenario, and for Installation Environment, select ECS. For Machine Group, select the resource quota machine group that you manually created in Step 1, and then click Next.

  4. In the Logtail configuration, specify the following parameters:

    • Set File Path to /var/log/containers-stdout/{container_name}, where {container_name} is the container name. For example, to collect logs from all custom containers, set the value to /var/log/containers-stdout/worker*.

    • For File name, enter *.log.

  5. Click Next to complete the configuration.

Collect logs from files in containers

  1. When you deploy a service, specify the directories of the log files to collect in the JSON configuration:

    {
      "cloud": {
        "logging": {
          "paths": [
            "/home/admin/logs",
            "/home/workspace/logs",
            "/var/log"
          ]
        },
        // Other configurations are omitted.
        "networking": {
          "security_group_id": "sg-xxxxx",
          "vswitch_id": "vsw-xxxxx",
          "vpc_id": "vpc-xxxxx",
        }
      }
    }
  2. In the Import Data section, click Single Line - Text Logs.

  3. For Usage Scenario, select Host Scenario, and for Installation Environment, select ECS. For Machine Group, select the resource quota machine group that you manually created in Step 1, and click Next.

  4. On the Logtail configuration page, set the file path to a path declared in the service JSON configuration. In the Input Configurations section, set the type to Collect text logs, set File Path to /home/admin/logs/**/*.log, and set Maximum Directory Monitoring Depth to 0.

  5. Click Next to complete the configuration.

References