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 the 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 the 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. If your server is an ECS instance that belongs to another Alibaba Cloud account, a server that is provided by a third-party cloud service provider, or a self-managed data center, you must manually install Logtail on the server. For more information, see Install Logtail on a Linux server or Install Logtail on a Windows server.Procedure
- Log on to the Log Service console.
- 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.
- Select a project and a Logstore. Then, click Next.
- In the Create Machine Group step, click the ECS Instances tab.
- Select ECS instances. You can use one of the following methods to select ECS instances.Important Make sure that Cloud Assistant is installed on the ECS instances.
By default, the Cloud Assistant client is pre-installed on ECS instances that are created from public images after December 1, 2017. On ECS instances that are purchased before December 1, 2017, you must install the Cloud Assistant client. For more information, see Install the Cloud Assistant client.
Method Description Manually Select Instances You can select one or more ECS instances from the instance list to install Logtail. You can filter instances based on several conditions, including Region, Tag, Status, Billing Method, and Network Type. You can also filter instances by entering a keyword.
Specify Instance Tags You can add tags to ECS instances. This way, you can categorize and manage resources. For more information, see Create or add a tag. After you add the 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 the resource groups, you can select a resource group. The system installs Logtail on all ECS instances in the resource group. Upload CSV File You can export a resource list from the ECS console as 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 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. - 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.
- Click Create.
- Confirm the settings and click OK. On the page that appears, you can click Refresh to update the execution status.
- After Logtail is installed on the specified ECS instances, click Complete Installation. After you install Logtail, you must configure a machine group and create a Logtail configuration. For more information, see Collect text logs.