Simple 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.
Limits
Simple Log Service can automatically install Logtail on an ECS instance only if the ECS instance resides in the same region as your project. If the ECS instance and the project reside in different regions, you must manually install Logtail on the ECS instance. In this case, the network type is Internet. For more information, see Install Logtail on a Linux server.
Prerequisites
Simple Log Service implements automatic installation of Logtail on ECS instances based on CloudOps Orchestration Service (OOS). If you use a Resource Access Management (RAM) user to log on to the Simple Log Service console, make sure that the RAM user has management permissions on OOS and the Data Imported by Logtail module supported by Simple Log Service.
Simple Log Service
In the Permission Assistant wizard, select Logtail-based Data Collection. For more information, see Configure the permission assistant feature.
OOS
System permissions: AliyunOOSFullAccess.
For more information about how to attach the AliyunOOSFullAccess policy to a RAM user, see Grant permissions to a RAM user.
Custom permissions: Create a custom policy that grants permissions to manage OOS resources based on the following example. For more information, see Create a custom policy.
After the custom policy is created, attach the policy to the RAM user. For more information, see 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": "*" } ] }
Procedure
Simple Log Service allows you to use Logtail to collect logs from ECS instances, servers in data centers, and servers from 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 a different Alibaba Cloud account from Simple Log Service, a server in a data center, or a server from a third-party cloud service provider, 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.
Log on to the Simple Log Service console.
In the Quick Data Import section, click Import Data. In the Import Data dialog box, click Regular Expression - Text Logs.
Regular Expression - Text Logs is used only as an example. You can select a different data source based on your business requirements.
In the Select Logstore step, configure Project and Logstore and click Next.
If you want to create a project and a Logstore, click Create Now. For more information, see Manage a project and Manage a Logstore.
In the Machine Group Configurations step, configure the parameters.
Select Servers for Scenario.
Select ECS for Installation Environment.
Click Create Machine Group next to Select Machine Group.
Specify ECS instances.
ImportantMake sure that Cloud Assistant Agent is installed on the ECS instances that you want to specify.
By default, Cloud Assistant Agent is pre-installed on ECS instances that are created from public images after December 1, 2017. If your ECS instances are purchased before December 1, 2017, you must install Cloud Assistant Agent on the instances. For more information, see Install Cloud Assistant Agent.
In the Create Machine Group panel, select the ECS instances on which you want to install Logtail. You can also create ECS instances. For more information, see Create an ECS instance.
Click Install and Create Machine Group.
If Success is displayed in the Logtail Installation Status column, Logtail is installed. If you want to select different ECS instances, click Recreate Installation Task. Then, go to Step 5 and select the instances.
What to do next
Simple Log Service projects and servers belong to the same account and reside in the same region
The following figure shows the configuration process.
After Logtail is installed, you must create a machine group and specify a data source to configure Logtail. Then, you can use Logtail to collect logs. For more information, see Create an IP address-based machine group, Create a custom identifier-based machine group, and Collect text logs from servers.
Simple Log Service projects and servers belong to different accounts and reside in the same region
The following figure shows the configuration process.
After Logtail is installed, you must configure a user identifier, configure a custom identifier, create a machine group, and specify a data source to configure Logtail. Then, you can use Logtail to collect logs. For more information, see Configure a user identifier, Create a custom identifier-based machine group, Collect text logs from servers, and Use Logtail to collect logs across Alibaba Cloud accounts.
Simple Log Service projects and servers reside in different regions
The following figure shows the configuration process.
You must install Logtail by using the installation command that is created for the Internet type. After you install Logtail, you must configure a user identifier, create a machine group, and specify a data source to configure Logtail. Then, you can use Logtail to collect logs. For more information, see Configure a user identifier, Create an IP address-based machine group, Create a custom identifier-based machine group, and Collect text logs from servers.
If you download Logtail over the classic network or a VPC, you can modify the network parameters in the /usr/local/ilogtail/ilogtail_config.json file to configure Logtail and collect logs across regions.
Modify the network parameters in the
/usr/local/ilogtail/ilogtail_config.json
file.For example, your project resides in the China (Chengdu) region and your ECS instance resides in the China (Hangzhou) region. Modify the parameters based on the following code:
{ "config_server_address" : "http://logtail.cn-chengdu.log.aliyuncs.com", "data_server_list" : [ { "cluster" : "cn-chengdu", "endpoint" : "cn-chengdu.log.aliyuncs.com" } ], ... }
Run the following command to restart Logtail:
sudo /etc/init.d/ilogtaild restart