If you want to use a Simple Log Service project to collect server logs, you must install Logtail. This topic describes how to install, update, and uninstall Logtail on a Linux server.
Limits
If your server has low specifications or your operating system runs an earlier version, compatibility issues may occur when you install Logtail version 2.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 ${region_id} -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 and Alibaba Cloud Linux 3
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, Debian GNU/Linux 11, and Debian GNU/Linux 12
Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04, and Ubuntu 24.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
NoteFor Logtail later than version 2.0, GNU C Library version 2.6 or later is required.
Linux operating systems that support the SSE4.2 and AVX instruction sets (Logtail later than version 2.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 and Ubuntu 24.04 for ARM
Debian GNU/Linux 11.2 for ARM
Linux operating systems that support ARMv8.2-A (Logtail later than version 2.0)
Install Logtail
The installation command varies based on the network type of the server on which you want to install Logtail. The network type refers to the network connection mode that is used by the Simple Log Service project to collect logs from servers. For more information about network types, see Select a network type.
If you install Logtail on an Elastic Compute Service (ECS) instance that resides in the classic network and then change the network type from classic network to Virtual Private Cloud (VPC), you must update the Logtail configuration. For more information, see How do I update a Logtail configuration after I switch the network type of an ECS instance from the classic network to a VPC?
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.
NoteWhen 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)
The region in which the ECS instance resides is not identified.
Download the Logtail installation script over the Internet and then configure 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.
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 +x logtail.sh
Configure the auto parameter to install Logtail. The Logtail installation package for a specific region is automatically downloaded over an Alibaba Cloud internal network. The download operation does not consume Internet traffic.
./logtail.sh install auto
The region in which the ECS instance resides is identified.
Obtain the value of the
${region_id}
parameter for the region in which the ECS instance resides. Replace the${region_id}
parameter with the obtained value and run the installation command.ImportantFor more information about the value of the
${region_id}
parameter for each region, see Supported regions. For example, the value of the${region_id}
parameter for the China (Hangzhou) region iscn-hangzhou
.wget http://logtail-release-${region_id}.oss-${region_id}-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod +x logtail.sh; ./logtail.sh install ${region_id}
Download the Logtail installation script over an Alibaba Cloud internal network and install Logtail. The download operation does not consume Internet traffic.
Internet
Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the installation command.ImportantFor more information about the value of the
${region_id}
parameter for each region, see Supported regions. For example, the value of the${region_id}
parameter for the China (Hangzhou) region iscn-hangzhou
.wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod +x logtail.sh; ./logtail.sh install ${region_id}-internet
Transfer acceleration
Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the installation command.ImportantFor more information about the value of the
${region_id}
parameter for each region, see Supported regions. For example, the value of the${region_id}
parameter for the China (Hangzhou) region iscn-hangzhou
.wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod +x logtail.sh; ./logtail.sh install ${region_id}-acceleration
Install Logtail offline
Download the installation script and installation package on a server that can access the Internet.
ImportantFor more information about the value of the
${region_id}
parameter for each region, see Supported regions. For example, the value of the${region_id}
parameter for the China (Hangzhou) region iscn-hangzhou
.Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the following command to download the installation script:wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh
Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the following command to download the installation package:Installation package (x86-64)
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail-linux64.tar.gz
Installation package (ARM)
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/aarch64/logtail-linux64.tar.gz
Copy the installation script and installation package to the server on which you want to install Logtail.
Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the installation command.ImportantFor more information about the value of the
${region_id}
parameter for each region, see Supported regions. For example, the value of the${region_id}
parameter for the China (Hangzhou) region iscn-hangzhou
.Internet
chmod +x logtail.sh; ./logtail.sh install-local ${region_id}-internet
Internal network
chmod +x logtail.sh; ./logtail.sh install-local ${region_id}
Transfer acceleration
chmod +x logtail.sh; ./logtail.sh install-local ${region_id}-acceleration
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
View the status and version of Logtail
View the status of Logtail
Run the following command to view the status of Logtail:
sudo /etc/init.d/ilogtaild status
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
Go to the installation directory of Logtail and open the
/usr/local/ilogtail/app_info.json
file. The value of thelogtail_version
field is the version of Logtail. Run the following command to view the version of Logtail: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
If you want to update Logtail, you can run the
upgrade
command. If you run theinstall
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.
Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the following commands to update Logtail:ImportantFor more information about the value of the
${region_id}
parameter for each region, see Supported regions. For example, the value of the${region_id}
parameter for the China (Hangzhou) region iscn-hangzhou
.wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod +x logtail.sh sudo ./logtail.sh upgrade
Check the update result.
The following sample result indicates that the upgrade is successful:
stop successfully Stop logtail successfully. Upgrading logtail files ... Upgrade logtail files successfully. Starting logtail ... ilogtail is running Upgrade logtail successfully. { "UUID" : "XXXXXXXX-XXXX", "compiler" : "GCC 9.3.1", "hostname" : "xxx", "instance_id" : "XXXXXXXX-XXXX_172.16.0.75_1730950372", "ip" : "172.16.0.75", "logtail_version" : "2.0.8", "os" : "Linux; 5.10.134-13.an8.x86_64; #1 SMP Mon Jan 9 10:39:46 CST 2023; x86_64", "update_time" : "2024-11-07 11:32:52" }
Update Logtail offline
Download the installation script and installation package on a server that can access the Internet.
ImportantFor more information about the value of the
${region_id}
parameter for each region, see Supported regions. For example, the value of the${region_id}
parameter for the China (Hangzhou) region iscn-hangzhou
.Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the following command to download the installation script:wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh
Obtain the value of the Simple Log Service parameter for the region in which the
Simple Log Service
project resides. Replace the${region_id}
parameter with the obtained value and run the following command to download the installation package:Installation package (x86-64)
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail-linux64.tar.gz
Installation package (ARM)
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/aarch64/logtail-linux64.tar.gz
Copy the installation script and installation package to the server on which you want to install Logtail.
Run the following command to update Logtail:
chmod +x logtail.sh; ./logtail.sh upgrade-local
Uninstall Logtail
For more information about the value of the ${region_id}
parameter for each region, see Supported regions. For example, the value of the ${region_id}
parameter for the China (Hangzhou) region is cn-hangzhou
.
Obtain the value of the Simple Log Service parameter for the region in which the Simple Log Service
project resides. Replace the ${region_id}
parameter with the obtained value and run the following command to uninstall Logtail:
wget http://logtail-release-${region_id}.oss-${region_id}.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod +x logtail.sh; ./logtail.sh uninstall
Scenarios
Simple Log Service projects and servers belong to the same account and reside in the same region
We recommend that you use Simple Log Service with Operation Orchestration Service (OOS) to automatically install Logtail on ECS instances that reside in the same region as your Simple Log Service projects. For more information, see Install Logtail on ECS instances.
If automatic installation does not meet your requirements, you can manually install Logtail based on this topic.
Simple Log Service projects and servers belong to the same account but reside in different regions
The following figure shows the configuration process.
You must install Logtail over the Internet. Then, you must create a machine group in a Simple Log Service project and configure Logtail to collect logs. For more information, see Create a machine group, and Collect text logs from servers.
If you install Logtail over the classic network or a VPC, you can modify the network parameters in the ilogtail_config.json file to configure Logtail to collect logs across regions. For more information, see Alibaba Cloud internal network (classic network or VPC).
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" } ], ... }
You must restart Logtail after the configuration file is modified.
sudo /etc/init.d/ilogtaild restart
Simple Log Service projects and servers belong to different accounts
In this scenario, the server on which you want to install Logtail belongs to an Alibaba Cloud account that is different from the account of your Simple Log Service projects or resides in a data center or a third-party cloud environment. The following figure shows the configuration process.
You must install Logtail over the Internet. Then, you must use the ID of Account A to configure a user identifier and configure a custom user identifier. For more information, see Configure a user identifier. Then, you must create a custom identifier-based machine group in the Simple Log Service project of Account A and configure Logtail to collect logs. For more information, see Create a custom identifier-based machine group, Collect text logs from servers, and Use Logtail to collect logs across Alibaba Cloud accounts.
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.