This topic describes how to use Logtail to collect ECS logs in the Log Service console.

Configuration process

  1. Install Logtail on your server.
  2. Configure a Logtail machine group.
  3. Create a Logtail Config and apply it to the machine group.
Figure 1. Configuration process


  • You have activated ECS and Log Service.
  • You have create a project and a Logstore. For more information, see Preparations.
    Note If your ECS instance uses a classic network or a VPC, the ECS instance and the Log Service project must belong to the same region.
  • If the ECS instance is created under another Alibaba Cloud account, you cannot automatically obtain the ECS instance owner information. In this case, you must configure an AliUid for the ECS instance.

Step 1: Install Logtail.

  1. Run the installation command.

    Choose a Logtail installation script according to the region to which the ECS instance belongs. For more information, see Install Logtail in Linux and Install Logtail in Windows.

    For example, if your Linux ECS instance belong to the China (Hangzhou) region and uses a classic network, you can run the following command to install Logtail:
    wget; chmod 755; sh install cn_hangzhou
  2. Check the Logtail run status by running the following command:
    /etc/init.d/ilogtaild status

    Logtail is successfully installed if ilogtail is running is returned.

Figure 2. Install Logtail

Step 2: Configure a machine group.

  1. In the Log Service console, click the target project.
  2. On the Logstores page, click Logtail Machine Group in the left-side navigation pane.
  3. On the Machine Groups page, click Create Machine Group.
  4. In the displayed dialog box, enter your ECS intranet IP address and custom ID, and then click Confirm.
    • Only ECS instances that belong to the same region with the Log Service project is supported.
    • Only ECS instances in the same region as the Log Service project are supported.
Figure 3. Configure a machine group

Step 3: Create a Logtail Config.

  1. On the Logstores page, find the target Logstore and click the Data Import Wizard icon.
  2. On the Select Data Source tab page, click Text File in the Custom Data.
  3. Configure the data source. For more information, see Collect text logs. This topic uses the Simple Mode as an example.

    Enter the ECS log path in the Log Path text box, and then click Next.

    Figure 4. Simple mode

  4. Select the machine group you created in Step 2 and click Apply to Machine Group.
    Figure 5. Apply the data source to the created machine group

You can then use Logtail to collect ECS logs. The following steps are for configuring indexes of collected logs or deliver logs.

View logs

Log on to the ECS console or run the echo "test message" >> /var/log/message command. The new logs are generated in your local directory /var/log/message. Logtail then collects the new logs and send them to Log Service.

On the Logstores page, find the target Logstore and click Search or Preview to view the logs collected by Logtail.

Figure 6. View logs

Figure 7. Preview logs

Figure 8. Retrieve logs