The Logtail client is a log collection agent provided by Log Service. This topic describes how to install the Logtail client on a Linux server.

Supported systems

The Logtail client for Linux supports the following x86-64 (64-bit) Linux systems:

  • Aliyun Linux
  • Ubuntu
  • Debian
  • CentOS
  • OpenSUSE
  • Red Hat

Prerequisites

  1. One or more servers are available.
  2. The network type for log collection is determined based on the type and region of the server. For more information, see Select a network type.
    Figure 1. Select a network type


Precautions

  • Logtail is installed in overwrite mode. If you have installed Logtail before, the installer will uninstall your current version of Logtail, delete the /usr/local/ilogtail directory, and reinstall Logtail. By default, Logtail is started after the installation and at startup.

  • The ${your_region_name} parameter is one of the installation parameters used for the installation of Docker and Kubernetes. Copy the value of the parameter from the region name table.

  • If the installation fails, click here to open a ticket.

Select an installation method

Before running the installation command, replace ${your_region_name} with the actual region name. The following table lists the names of different regions. You can also copy and run the installation commands for the corresponding region and network type.
Table 1. Region names for Logtail installation
Region Region name Region Region name
China (Hangzhou) cn-hangzhou Australia (Sydney) ap-southeast-2
China (Shanghai) cn-shanghai Malaysia (Kuala Lumpur) ap-southeast-3
China (Qingdao) cn-qingdao Indonesia (Jakarta) ap-southeast-5
China (Beijing) cn-beijing India (Mumbai) ap-south-1
China (Zhangjiakou) cn-zhangjiakou Japan (Tokyo) ap-northeast-1
China (Hohhot) cn-huhehaote Germany (Frankfurt) eu-central-1
China (Shenzhen) cn-shenzhen UAE (Dubai) me-east-1
China (Chengdu) cn-chengdu UK (London) eu-west-1
Hong Kong cn-hongkong
US (Silicon Valley) us-west-1
US (Virginia) us-east-1
Singapore ap-southeast-1 - -

Install Logtail through the Alibaba Cloud internal network

The Alibaba Cloud internal network is a shared gigabit network, which provides faster and more stable data transfer than the Internet and does not consume Internet bandwidth.

You can install Logtail through the Alibaba Cloud internal network when the following conditions are met:
  • Alibaba Cloud ECS instances are deployed.
  • The ECS instances and the Log Service project are located in the same region.
When running the installation command, you need to specify the region. You can use the auto parameter or manually specify the region.
  • Use the auto parameter
    If you are not sure about the region of the ECS instance, you can use the auto parameter of the installer to install Logtail. The Logtail installer obtains the metadata from the server and automatically determines the region of the ECS instance.
    1. Download the Logtail installer through the Internet. This operation requires access to the Internet and consumes about 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. Use the auto parameter for installation. This operation does not consume Internet traffic. The installation program of the corresponding region will be automatically downloaded.
      ./logtail.sh install auto
  • Manually specify the region
    You can also manually install Logtail. Downloading the Logtail installer through the internal network does not consume Internet traffic.
    1. Obtain the name of the region where the Log Service project is located.

      In the installation command, ${your_region_name} indicates the name of the region where the Log Service project is located. Select the region name according to the region name table. For example, the name of the China (Hangzhou) region is cn-hangzhou.

    2. Run the installation command after replacing ${your_region_name} with the actual region name.

      Replace ${your_region_name} with the actual region name, 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}
      The following table lists the installation commands for different regions. You can also install Logtail by running the command corresponding to the region where your Log Service project is located.
      Region Installation command
      China (Hangzhou)
      wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-hangzhou
      China (Shanghai)
      wget http://logtail-release-cn-shanghai.oss-cn-shanghai-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-shanghai
      China (Qingdao)
      wget http://logtail-release-cn-qingdao.oss-cn-qingdao-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-qingdao
      China (Beijing)
      wget http://logtail-release-cn-beijing.oss-cn-beijing-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-beijing
      China (Zhangjiakou)
      wget http://logtail-release-cn-zhangjiakou.oss-cn-zhangjiakou-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-zhangjiakou
      China (Hohhot)
      wget http://logtail-release-cn-huhehaote.oss-cn-huhehaote-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-huhehaote
      China (Shenzhen)
      wget http://logtail-release-cn-shenzhen.oss-cn-shenzhen-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-shenzhen
      China (Chengdu)
      wget http://logtail-release-cn-chengdu.oss-cn-chengdu-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-chengdu
      Hong Kong
      wget http://logtail-release-cn-hongkong.oss-cn-hongkong-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-hongkong
      US (Silicon Valley)
      wget http://logtail-release-us-west-1.oss-us-west-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install us-west-1
      US (Virginia)
      wget http://logtail-release-us-east-1.oss-us-east-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install us-east-1
      Singapore
      wget http://logtail-release-ap-southeast-1.oss-ap-southeast-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-1
      Australia (Sydney)
      wget http://logtail-release-ap-southeast-2.oss-ap-southeast-2-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-2
      Malaysia (Kuala Lumpur)
      wget http://logtail-release-ap-southeast-3.oss-ap-southeast-3-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-3
      Indonesia (Jakarta)
      wget http://logtail-release-ap-southeast-5.oss-ap-southeast-5-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-5
      Japan (Tokyo)
      wget http://logtail-release-ap-northeast-1.oss-ap-northeast-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-northeast-1
      India (Mumbai)
      wget http://logtail-release-ap-south-1.oss-ap-south-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-south-1
      Germany (Frankfurt)
      wget http://logtail-release-eu-central-1.oss-eu-central-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install eu-central-1
      UAE (Dubai)
      wget http://logtail-release-me-east-1.oss-me-east-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install me-east-1
      UK (London)
      wget http://logtail-release-eu-west-1.oss-eu-west-1-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install eu-west-1

Install Logtail through the Internet

Data is written to Log Service through the Internet, which consumes Internet bandwidth. You can use this method to install Logtail on a server deployed in an on-premises IDC or provided by another cloud service vendor.
Note Log Service cannot obtain the owner information about other types of servers. In this case, you must manually configure AliUids after installing Logtail. Otherwise, Logtail has abnormal heartbeats and cannot collect logs. For more information about AliUids, see Configure AliUids for ECS servers under other Alibaba Cloud accounts or on-premises IDCs.
  1. Obtain the name of the region where the Log Service project is located.

    In the installation command, ${your_region_name} indicates the name of the region where the Log Service project is located. Select the region name according to the region name table. For example, the name of the China (Hangzhou) region is cn-hangzhou.

  2. Run the installation command after replacing ${your_region_name} with the actual region name.

    Replace ${your_region_name} with the actual region name, 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
    The following table lists the installation commands for different regions. You can also install Logtail by running the command corresponding to the region where your Log Service project is located.
    Region Installation command
    China (Hangzhou)
    wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-hangzhou-internet
    China (Shanghai)
    wget http://logtail-release-cn-shanghai.oss-cn-shanghai.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-shanghai-internet
    China (Qingdao)
    wget http://logtail-release-cn-qingdao.oss-cn-qingdao.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-qingdao-internet
    China (Beijing)
    wget http://logtail-release-cn-beijing.oss-cn-beijing.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-beijing-internet
    China (Zhangjiakou)
    wget http://logtail-release-cn-zhangjiakou.oss-cn-zhangjiakou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-zhangjiakou-internet
    China (Hohhot)
    wget http://logtail-release-cn-huhehaote.oss-cn-huhehaote.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-huhehaote-internet
    China (Shenzhen)
    wget http://logtail-release-cn-shenzhen.oss-cn-shenzhen.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-shenzhen-internet
    China (Chengdu)
    wget http://logtail-release-cn-chengdu.oss-cn-chengdu.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-chengdu-internet
    Hong Kong
    wget http://logtail-release-cn-hongkong.oss-cn-hongkong.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-hongkong-internet
    US (Silicon Valley)
    wget http://logtail-release-us-west-1.oss-us-west-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install us-west-1-internet
    US (Virginia)
    wget http://logtail-release-us-east-1.oss-us-east-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install us-east-1-internet
    Singapore
    wget http://logtail-release.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; sh logtail.sh install ap-southeast-1-internet
    Australia (Sydney)
    wget http://logtail-release-ap-southeast-2.oss-ap-southeast-2.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-2-internet
    Malaysia (Kuala Lumpur)
    wget http://logtail-release-ap-southeast-3.oss-ap-southeast-3.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-3-internet
    Indonesia (Jakarta)
    wget http://logtail-release-ap-southeast-5.oss-ap-southeast-5.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-5-internet
    Japan (Tokyo)
    wget http://logtail-release-ap-northeast-1.oss-ap-northeast-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-northeast-1-internet
    Germany (Frankfurt)
    wget http://logtail-release-eu-central-1.oss-eu-central-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install eu-central-1-internet
    UAE (Dubai)
    wget http://logtail-release-me-east-1.oss-me-east-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install me-east-1-internet
    India (Mumbai)
    wget http://logtail-release-ap-south-1.oss-ap-south-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-south-1-internet
    UK (London)
    wget http://logtail-release-eu-west-1.oss-eu-west-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install eu-west-1-internet

Install Logtail with Global Acceleration enabled

If your servers are deployed in on-premises IDCs outside Mainland China or provided by cloud service vendors outside Mainland China, using the Internet to transmit data may cause problems such as high latency and unstable transmission. In this case, you can enable Global Acceleration. Global Acceleration accelerates log collection by using the edge nodes of Alibaba Cloud CDN. Compared with data transmission through the Internet, Global Acceleration offers a more stable network with minimal transmission latency.
  1. Obtain the name of the region where the Log Service project is located.

    In the installation command, ${your_region_name} indicates the name of the region where the Log Service project is located. Select the region name according to the region name table. For example, the name of the China (Hangzhou) region is cn-hangzhou.

  2. Run the installation command after replacing ${your_region_name} with the actual region name.

    Replace ${your_region_name} with the actual region name, 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
    The following table lists the installation commands for different regions. You can also install Logtail by running the command corresponding to the region where your Log Service project is located.
    China (Beijing)
    wget http://logtail-release-cn-beijing.oss-cn-beijing.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-beijing-acceleration
    China (Qingdao)
    wget http://logtail-release-cn-qingdao.oss-cn-qingdao.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-qingdao-acceleration
    China (Hangzhou)
    wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-hangzhou-acceleration
    China (Shanghai)
    wget http://logtail-release-cn-shanghai.oss-cn-shanghai.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-shanghai-acceleration
    China (Shenzhen)
    wget http://logtail-release-cn-shenzhen.oss-cn-shenzhen.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-shenzhen-acceleration
    China (Zhangjiakou)
    wget http://logtail-release-cn-zhangjiakou.oss-cn-zhangjiakou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-zhangjiakou-acceleration
    China (Hohhot)
    wget http://logtail-release-cn-huhehaote.oss-cn-huhehaote.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-huhehaote-acceleration
    China (Chengdu)
    wget http://logtail-release-cn-chengdu.oss-cn-chengdu.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-chengdu-acceleration
    Hong Kong
    wget http://logtail-release-cn-hongkong.oss-cn-hongkong.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-hongkong-acceleration
    US (Silicon Valley)
    wget http://logtail-release-us-west-1.oss-us-west-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install us-west-1-acceleration
    US (Virginia)
    wget http://logtail-release-us-east-1.oss-us-east-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install us-east-1-acceleration
    Singapore
    wget http://logtail-release-ap-southeast-1.oss-ap-southeast-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-1-acceleration
    Australia (Sydney)
    wget http://logtail-release-ap-southeast-2.oss-ap-southeast-2.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-2-acceleration
    Malaysia (Kuala Lumpur)
    wget http://logtail-release-ap-southeast-3.oss-ap-southeast-3.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-3-acceleration
    Indonesia (Jakarta)
    wget http://logtail-release-ap-southeast-5.oss-ap-southeast-5.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-southeast-5-acceleration
    Japan (Tokyo)
    wget http://logtail-release-ap-northeast-1.oss-ap-northeast-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-northeast-1-acceleration
    Germany (Frankfurt)
    wget http://logtail-release-eu-central-1.oss-eu-central-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install eu-central-1-acceleration
    UAE (Dubai)
    wget http://logtail-release-me-east-1.oss-me-east-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install me-east-1-acceleration
    India (Mumbai)
    wget http://logtail-release-ap-south-1.oss-ap-south-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install ap-south-1-acceleration
    UK (London)
    wget http://logtail-release-eu-west-1.oss-eu-west-1.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install eu-west-1-acceleration

View the Logtail version

Logtail records version information in the logtail_version field in the /usr/local/ilogtail/app_info.json file.
$cat /usr/local/ilogtail/app_info.json
{
   "UUID" : "0DF18E97-0F2D-486F-B77F-*********",
   "hostname" : "david*******",
   "instance_id" : "F4FAFADA-F1D7-11E7-846C-00163E30349E_*********_1515129548",
   "ip" : "**********",
   "logtail_version" : "0.16.0",
   "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" : "2018-01-05 13:19:08"
}

Upgrade Logtail

You can use the Logtail installer (logtail.sh) to upgrade Logtail. The installer automatically selects an appropriate upgrade method based on the configuration information of the installed Logtail.
Note During the upgrade, Logtail will be temporarily stopped. Only necessary files are overwritten. The configuration file, checkpoint file, and logs are retained.
Run the following commands to upgrade Logtail:
# Download the Logtail installer.
wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh
# Upgrade Logtail.
sudo ./logtail.sh upgrade
Response:
# The upgrade is successful.
Stop logtail successfully.
ilogtail is running
Upgrade logtail success
{
   "UUID" : "***",
   "hostname" : "***",
   "instance_id" : "***",
   "ip" : "***",
   "logtail_version" : "0.16.11",
   "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" : "2018-08-29 15:01:36"
}

# The upgrade fails because the current version is the latest version.
[Error]:    Already up to date.

Manually start or stop Logtail

  • Start Logtail
    Run the following command as an administrator to start Logtail:
    /etc/init.d/ilogtaild start
  • Stop Logtail
    Run the following command as an administrator to stop Logtail:
    /etc/init.d/ilogtaild stop

Uninstall Logtail

Download the Logtail installer logtail.sh, and then run the following commands to uninstall Logtail:

wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh
chmod 755 logtail.sh; ./logtail.sh uninstall