Log Service allows you to install Logtail on Alibaba Cloud Elastic Compute Service (ECS) instances. This topic describes how to specify ECS instances and install Logtail on the ECS instances in the wizard that is used to create a Logtail configuration.

Prerequisites

If you use a RAM user to install Logtail on ECS instances, the RAM user must have the following permissions:
  • AliyunOOSFullAccess permission: For more information about how to grant the AliyunOOSFullAccess permission to a RAM user, see Grant permissions to a RAM user.
  • Custom permissions: To grant the following custom permissions to a RAM user, you must create a custom policy and attach the custom policy to the RAM user. For more information, see Create a custom policy and Grant permissions to a RAM user.
     {
        "Version": "1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "ecs:DescribeTagKeys",
                    "ecs:DescribeTags",
                    "ecs:DescribeInstances",
                    "ecs:DescribeInvocationResults",
                    "ecs:RunCommand",
                    "ecs:DescribeInvocations"
                ],
                "Resource": "*"
            },
            {
                "Effect": "Allow",
                "Action": [
                    "oos:ListTemplates",
                    "oos:StartExecution",
                    "oos:ListExecutions",
                    "oos:GetExecutionTemplate",
                    "oos:ListExecutionLogs",
                    "oos:ListTaskExecutions"
                ],
                "Resource": "*"
            }
        ]
    }

Background information

Log Service allows you to use Logtail to collect logs from ECS instances, self-managed servers, and servers that are provided by third-party cloud service providers. Before you collect logs, you must install Logtail on your servers. For more information about how to install Logtail on self-managed servers or servers that are provided by third-party cloud service providers, see Install Logtail on a Linux server or Install Logtail on a Windows server.

Procedure

  1. Log on to the Log Service console.
  2. In the Import Data section, select Delimiter Mode - Text Log.
    In this example, Delimiter Mode - Text Log is selected as the data source. You can select a different data source based on your business requirements.
  3. Select a project and a Logstore. Then, click Next.
  4. In the Create Machine Group step, click the ECS Instances tab.
  5. Select ECS instances.
    You can use one of the following methods to select ECS instances. Select ECS instances
    Method Description
    Manually Select Instances From the instance list, you can select one or more instances on which you want to install Logtail.

    You can filter instances by Region, Tag, Status, Billing Method, and Network Type. You can also filter instances by using keywords.

    Specify Instance Tags You can add tags to ECS instances. This helps you categorize and manage resources. For more information, see Create or bind a tag. After you add tags, you can specify one or more tags to select instances. The system installs Logtail on all ECS instances to which the tags are added.

    A tag is a key-value pair. The tag key is required, and the tag value is optional. If you select only tag keys, the system installs Logtail on all ECS instances for which tag keys are specified.

    Specify Resource Group You can configure resource groups for ECS instances to manage resources in a hierarchical manner. For more information, see Resource groups. After you configure resource groups, you can select a resource group. The system installs Logtail on all ECS instances in the resource group.
    Upload CSV File In the ECS console, you can export a resource list to a CSV file. After you export the resource list, you can upload the CSV file for this parameter. The system installs Logtail on all ECS instances in the resource list.
    Select All If you select this option, the system automatically installs Logtail on all ECS instances that belong to the current Alibaba Cloud account.
    Specify Inventory Conditions After you create a configuration list in the Operation Orchestration Service (OOS) console, you can use the configuration list to specify the ECS instances on which you want to install Logtail. For more information, see Use OOS to collect the data of ECS instances.
  6. Optional:Configure advanced parameters.
    Parameter Description
    Description Enter a description for the installation task.
    Tags for Resource Groups After you select a resource group, the system adds the resource group information to the execution record.
    Execution Mode Select one of the following modes:
    • Automatic: If Logtail fails to be installed on a server, Log Service attempts to install Logtail on the next available server.
    • Suspend upon Failure: If Logtail fails to be installed on a server, Log Service attempts to install Logtail on the server again.
    Rate Control Select one of the following modes:
    • Concurrency-based Control: Logtail is installed on all of the specified ECS instances at the same time.
    • Batch-based Control: Logtail is installed on the specified ECS instances in batches.
    Concurrency Specify the concurrency rate. The value can be a number or percentage. For example, if you set the Concurrency parameter to 2 Targets, Logtail is installed on two ECS instances at the same time.
    Note If you set the Rate Control parameter to Concurrency-based Control, you must configure this parameter.
    Batch Array Enter an array that specifies how Logtail is installed. Log Service installs Logtail on the specified ECS instances in batches based on the array that you specify. Log Service installs Logtail on the next batch of ECS instances only after Logtail is installed on the current batch of ECS instances. You can enter an array that consists of numbers or percentages. If you set the Batch Array parameter to [1, 5%, 10%], Logtail is installed on an ECS instance in the first batch. In the second batch, Logtail is installed on 5% of the total instances. In the third and subsequent batches, Logtail is installed on 10% of the total instances.
    Note If you set the Rate Control parameter to Batch-based Control, you must configure this parameter.
    Error Threshold Specify the maximum number of errors or the maximum error rate that is allowed before the installation task is stopped. Default value: 0.

    For example, Logtail needs to be installed on four ECS instances. In this example, the Concurrency parameter is set to 1 Targets, and the Error Threshold parameter is set to 0 Errors. If Logtail fails to be installed on one of the ECS instances, the installation on the subsequent servers is canceled.

  7. Click Execute Now.
    On the page that appears, you can view the installation results. The installation results include the basic information, instance list, and logs. Installation results

What to do next

Configure the parameters in the Machine Group Settings and Logtail Config steps. For more information, see Collect text logs.