All Products
Search
Document Center

Simple Log Service:Install Logtail on a Linux server

Last Updated:Sep 18, 2024

This topic describes how to install, update, and uninstall Logtail on a Linux server.

Limits

Important

If your server has low specifications or your operating system runs an earlier version, compatibility issues may occur when you install Logtail V2.0. In this case, other software cannot run as expected. We recommend that you download Logtail V1.8.7 and run the ./logtail.sh install ${your_region_name} -v 1.8.7 command to install Logtail.

  • You can install Logtail on servers that run one of the following x86-64 Linux operating systems:

    • Alibaba Cloud Linux 2

    • Red Hat Enterprise Linux 6, Red Hat Enterprise Linux 7, and Red Hat Enterprise Linux 8

    • CentOS Linux 6, CentOS Linux 7, and CentOS Linux 8

    • Debian GNU/Linux 8, Debian GNU/Linux 9, Debian GNU/Linux 10, and Debian GNU/Linux 11

    • Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, and Ubuntu 20.04

    • SUSE Linux Enterprise Server 11, SUSE Linux Enterprise Server 12, and SUSE Linux Enterprise Server 15

    • openSUSE Leap 15.1, openSUSE Leap 15.2, and openSUSE Leap 42.3

    • Linux operating systems based on GNU C Library version 2.5 or later

    • Linux operating systems that support the SSE4.2 instruction set (Logtail later than V2.0)

  • You can install Logtail on servers that run one of the following ARM64 Linux operating systems:

    • Alibaba Cloud Linux 3.2 for ARM

    • Anolis OS 8.2 for ARM or later

    • CentOS Linux 8.4 for ARM

    • Ubuntu 20.04 for ARM

    • Debian GNU/Linux 11.2 for ARM

    • Linux operating systems that support ARMv8.2-A (Logtail later than V2.0)

Install Logtail

Important

Install Logtail online

Network type

Scenario

Alibaba Cloud internal network

The ECS instance that is used and your Simple Log Service project reside in the same region.

Internet

  • The ECS instance that is used and your Simple Log Service project reside in different regions.

  • The server that is used is from a third-party cloud service provider or in a data center.

Transfer acceleration

The server that is used is from a third-party cloud service provider outside China or in a data center outside China. Data transfer over the Internet may cause high network latency and unstable connections. In this case, we recommend that you use the transfer acceleration feature to transfer logs.

Note

When you install Logtail online, Logtail is automatically installed based on the operating system of your server. You do not need to select a network type.

Alibaba Cloud internal network (classic network or VPC)

  • If you cannot identify the region where your ECS instance resides, you can download the Logtail installation script and use the auto parameter to install Logtail.

    After you configure the auto parameter in the installation command, the Logtail installation script automatically obtains and uses the metadata of the ECS instance to identify the region of the ECS instance. For more information about the metadata of ECS instances, see Overview of ECS instance metadata.

    1. Download the Logtail installation script over the Internet to the working directory of the ECS instance. The download operation consumes approximately 10 KB of Internet traffic.

      wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh
    2. Install Logtail by using the auto parameter.

      The Logtail installation package for a specific region is automatically downloaded. The download operation does not consume Internet traffic.

      ./logtail.sh install auto
  • If you can identify the region where your ECS instance resides, you can specify the region in the installation command.

    Download the Logtail installation script over an internal network and install Logtail. The download operation does not consume Internet traffic.

    1. Obtain the value of the ${your_region_name}variable for the region where your Simple Log Service project resides.

      For more information about the value of the ${your_region_name} variable for each region, see Appendix: Region names for Logtail installation. For example, the value of the ${your_region_name} variable for the China (Hangzhou) region is cn-hangzhou.

    2. Replace the ${your_region_name} variable in the installation command with the value for the region where your project resides, and then run the installation command.

      wget http://logtail-release-${your_region_name}.oss-${your_region_name}-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ${your_region_name}

Internet

  1. Obtain the value of the ${your_region_name}variable for the region where your Simple Log Service project resides.

    For more information about the value of the ${your_region_name} variable for each region, see Appendix: Region names for Logtail installation. For example, the value of the ${your_region_name} variable for the China (Hangzhou) region is cn-hangzhou.

  2. Replace the ${your_region_name} variable in the installation command with the value for the region where your project resides, and then run the installation command.

    wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ${your_region_name}-internet

Transfer acceleration

  1. Obtain the value of the ${your_region_name}variable for the region where your Simple Log Service project resides.

    For more information about the value of the ${your_region_name} variable for each region, see Appendix: Region names for Logtail installation. For example, the value of the ${your_region_name} variable for the China (Hangzhou) region is cn-hangzhou.

  2. Replace the ${your_region_name} variable in the installation command with the value for the region where your project resides, and then run the installation command.

    wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ${your_region_name}-acceleration

Install Logtail offline

  1. Log on to a server that can be accessed over the Internet.

  2. Replace the ${your_region_name} variable in the download commands with the value for the region where your project resides, and then run the download commands to download the installation script and installation package.

    For more information about the value of the ${your_region_name} variable for each region, see Appendix: Region names for Logtail installation. For example, the value of the ${your_region_name} variable for the China (Hangzhou) region is cn-hangzhou.

    1. Download the installation script.

      wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/logtail.sh
    2. Download the installation package.

      • Installation package (x86-64)

        wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/logtail-linux64.tar.gz
      • Installation package (ARM)

        wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/aarch64/logtail-linux64.tar.gz
  3. Copy the installation script and installation package to the server on which you want to install Logtail.

  4. Replace the ${your_region_name} variable in the installation command with the value for the region where your project resides, and then run the installation command on the server on which you want to install Logtail.

    For more information about the value of the ${your_region_name} variable for each region, see Appendix: Region names for Logtail installation. Examples:

    • The value of the ${your_region_name} variable for the China (Hangzhou) region whose resources can be accessed over the Internet is cn-hangzhou-internet.

    • The value of the ${your_region_name} variable for the China (Hangzhou) region whose resources can be accessed over an internal network is cn-hangzhou.

    • The value of the ${your_region_name} variable for the China (Hangzhou) region whose resources can be accessed by using transfer acceleration is cn-hangzhou-acceleration.

    chmod +x logtail.sh; ./logtail.sh install-local ${your_region_name}

View the status and version of Logtail

After Logtail is installed on your server, you can view the status and version of Logtail.

View the status of Logtail

View the status of Logtail to check whether Logtail is installed on your server.

  • Command

    sudo /etc/init.d/ilogtaild status 
  • Output

    If the following information is returned, Logtail is installed:

    ilogtail is running

    If Logtail is not in the Running state, uninstall Logtail and then reinstall Logtail.

View the version of Logtail

Open the /usr/local/ilogtail/app_info.json file. The value of the logtail_version field is the version of Logtail.

  • Command

    cat /usr/local/ilogtail/app_info.json
  • Output

    {
       "UUID" : "0DF18E97-0F2D-486F-B77F-*********",
       "hostname" : "david*******",
       "instance_id" : "F4FAFADA-F1D7-11E7-846C-00163E30349E_*********_1515129548",
       "ip" : "**********",
       "logtail_version" : "0.16.30",
       "os" : "Linux; 2.6.32-220.23.2.ali1113.el5.x86_64; #1 SMP Thu Jul 4 20:09:15 CST 2013; x86_64",
       "update_time" : "2020-01-05 13:19:08"
    }

Update Logtail

Important
  • If you want to update Logtail, you can run the upgrade command. If you run the install command to update Logtail, an overwrite installation is performed. The system uninstalls the current version of Logtail, deletes related directories such as /usr/local/ilogtail, and then installs a new version of Logtail. If the installation is successful, Logtail automatically runs and is added as a startup program.

  • Logtail is temporarily stopped during the update. No log data is lost. After Logtail is updated, only the configuration files and the checkpoint files are retained. Other files are overwritten.

Update Logtail online

You can use the Logtail installation script logtail.sh to update Logtail. The installation script automatically selects an update method based on the configurations of Logtail that is installed.

  1. Run the following commands to update Logtail:

    wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh
    sudo ./logtail.sh upgrade
  2. Check the update result.

    If information similar to the following example is returned, the update is successful:

    Stop logtail successfully.
    ilogtail is running
    Upgrade logtail success
    {
       "UUID" : "***",
       "hostname" : "***",
       "instance_id" : "***",
       "ip" : "***",
       "logtail_version" : "0.16.30",
       "os" : "Linux; 3.10.0-693.2.2.el7.x86_64; #1 SMP Tue Sep 12 22:26:13 UTC 2017; x86_64",
       "update_time" : "2020-08-29 15:01:36"
    }

Update Logtail offline

  1. Log on to a server that can be accessed over the Internet.

  2. Replace the ${your_region_name} variable in the download commands with the value for the region where your project resides, and then run the download commands.

    For more information about the value of the ${your_region_name} variable for each region whose resources can be accessed over the Internet, see Appendix: Region names for Logtail installation. For example, the value of the ${your_region_name} variable for the China (Hangzhou) region whose resources can be accessed over the Internet is cn-hangzhou-internet.

    1. Run the following command to download the installation script:

      wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/logtail.sh
    2. Run the following command to download the installation package:

      wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/logtail-linux64.tar.gz
  3. Copy the installation script and installation package to the server on which you want to update Logtail.

  4. Run the following command to update Logtail:

    chmod +x logtail.sh; ./logtail.sh upgrade-local

Start and stop Logtail

  • Run the following command to start Logtail:

    sudo /etc/init.d/ilogtaild start
  • Run the following command to stop Logtail:

    sudo /etc/init.d/ilogtaild stop

Uninstall Logtail

  1. Obtain the value of the ${your_region_name} variable for the region where your Simple Log Service project resides.

    For more information about the value of the ${your_region_name} variable for each region, see Appendix: Region names for Logtail installation. For example, the value of the ${your_region_name} variable for the China (Hangzhou) region is cn-hangzhou.

  2. Replace the value of the ${your_region_name} variable and run the following command to uninstall Logtail:

    wget http://logtail-release-${your_region_name}.oss-${your_region_name}.aliyuncs.com/linux64/logtail.sh -O logtail.sh;chmod 755 logtail.sh;./logtail.sh uninstall

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.

image

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.

image

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.

image

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.

  1. 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"
        }
      ],
      ...
    }
  2. Run the following command to restart Logtail:

    sudo /etc/init.d/ilogtaild restart

FAQ

How do I check whether Logtail is installed?

You can view the status of Logtail to check whether Logtail is installed on your server. For more information, see View the status of Logtail.

After Logtail is installed, the heartbeat status of my machine group that is created for the Logtail configuration is FAIL. What do I do?

If heartbeat status is FAIL after a Logtail configuration is created, you can run the following command to view the version of Logtail. Then, update Logtail to check whether the heartbeat status becomes normal.

cat /usr/local/ilogtail/app_info.json

After Logtail is installed, Logtail starts to collect logs. However, a status code indicating that logs fail to be collected is returned. What do I do?

Logtail aggregates collected logs and sends the aggregated logs to Simple Log Service. If logs fail to be sent to Simple Log Service, Logtail determines whether to send the logs again or to stop sending the logs based on the error message. For more information, see Send logs.

Appendix: Region names for Logtail installation

The following table describes the value of the ${your_region_name} variable for each region.

Region

City

Region ID

China (Qingdao)

Qingdao

cn-qingdao

China (Beijing)

Beijing

cn-beijing

China (Zhangjiakou)

Zhangjiakou

cn-zhangjiakou

China (Hohhot)

Hohhot

cn-huhehaote

China (Ulanqab)

Ulanqab

cn-wulanchabu

China (Hangzhou)

Hangzhou

cn-hangzhou

China (Shanghai)

Shanghai

cn-shanghai

China (Shenzhen)

Shenzhen

cn-shenzhen

China (Heyuan)

Heyuan

cn-heyuan

China (Guangzhou)

Guangzhou

cn-guangzhou

China (Chengdu)

Chengdu

cn-chengdu

China (Hong Kong)

Hong Kong, China

cn-hongkong

Singapore

Singapore

ap-southeast-1

Malaysia (Kuala Lumpur)

Kuala Lumpur

ap-southeast-3

Indonesia (Jakarta)

Jakarta

ap-southeast-5

Philippines (Manila)

Manila

ap-southeast-6

Thailand (Bangkok)

Bangkok

ap-southeast-7

Japan (Tokyo)

Tokyo

ap-northeast-1

South Korea (Seoul)

Seoul

ap-northeast-2

US (Silicon Valley)

Silicon Valley

us-west-1

US (Virginia)

Virginia

us-east-1

Germany (Frankfurt)

Frankfurt

eu-central-1

UK (London)

London

eu-west-1

UAE (Dubai)

Dubai

me-east-1