If the heartbeat status of the Logtail machine group is abnormal when you use Logtail to collect logs, you can troubleshoot the error manually or by using the Logtail automatic diagnostic tool.
Automatic diagnosis: Log Service provides the Logtail automatic diagnostic tool for Linux. For more information, see How do I use the Logtail automatic diagnostic tool?
Manual diagnosis: If the Logtail diagnostic tool fails to troubleshoot the error or your server is running in Windows, troubleshoot the error by performing the following steps.
1. Check whether Logtail is installed
Run the following command to check whether Logtail is installed. If you do not install Logtail, see Install Logtail in Linux or Install Logtail in Windows to install it. You must install Logtail based on the region of your Log Service project and the network type.
sudo /etc/init.d/ilogtaild statusIf
ilogtail is runningis returned, Logtail is installed, as shown in the following example:
[root@****************~]# sudo /etc/init.d/ilogtaild status ilogtail is running
- On Control Panel, choose System and Security > Administrative Tools, and then double-click Services.
- Check the running status of LogtailDaemon and LogtailWorker. If they are running normally, Logtail is installed.
If Logtail is running, go to the next step.
2. Check whether the Logtail installation parameter is correct
Before installing Logtail, you must to specify the correct network endpoint. That is, you must select a correct Logtail installation parameter from Table 1 based on the region of the Log Service project and decide how to install Logtail based on the network type. If the installation script or parameter is incorrect, the Logtail client may have no heartbeat.
- Linux: /usr/local/ilogtail/ilogtail_config.json
- Windows x64: C:\Program Files (x86)\Alibaba\Logtail\ilogtail_config.json
- Windows x32: C:\Program Files\Alibaba\Logtail\ilogtail_config.json
- Check the installation parameter.
Check whether the region of the network endpoint recorded in the ilogtail_config.json file is the same as that of your Log Service project.
For example, the returned information in the following figure indicates that Logtail is installed on an ECS instance in China (Hangzhou).
- Check the installation method.
Telnet the domain name configured in the ilogtail_config.json file to check whether Logtail is properly installed based on the network type of the server.
For example, the domain name recorded in the ilogtail_config.json file is
cn-hangzhou-intranet. You can run the
telnet logtail.cn-hangzhou-intranet.log.aliyuncs.com 80command to check the network connectivity. If Logtail is connected to the server, Logtail is properly installed.For example, run the following command to check whether Logtail is connected to an ECS instance that is running in Linux:
[root@*********** ~]# telnet logtail.cn-hangzhou-intranet.log.aliyuncs.com 80 Trying 100*0*7*5... Connected to logtail.cn-hangzhou-intranet.log.aliyuncs.com. Escape character is '^]'.
If the telnet command fails, the Logtail installation parameter is incorrect, so that the installation command is incorrect. For more information about how to select a correct installation parameter, see Install Logtail in Linux or Install Logtail in Windows.
If Logtail is properly installed, go to the next step.
3. Check whether the IP address configuration of the machine group is correct
The server IP address obtained by the Logtail client must be configured in the machine group. Otherwise, the Logtail client has no heartbeat in the machine group or Logtail cannot collect logs.
The Logtail client obtains the server IP address as follows:
If no hostname is bound, the Logtail client obtains the IP address of the first NIC of the server.
If a hostname is bound in the /etc/hosts file, the Logtail client obtains the bound IP address. You can run the hostname command to view the hostname.
- Check the server IP address obtained by the Logtail client.
ipfield in the app_info.json file indicates the server IP address obtained by the Logtail client. This file is stored in:
- Linux: /usr/local/ilogtail/app_info.json
- Windows x64: C:\Program Files (x86)\Alibaba\Logtail\app_info.json
- Windows x32: C:\Program Files\Alibaba\Logtail\app_info.json
- Logtail cannot work if the
ipfield in the
app_info.jsonfile is empty. In this case, you must to configure an IP address for the server and restart Logtail.
app_info.jsonfile only records information. Any modification to this file does not change the server IP address obtained by the Logtail client.
- Check the IP address configuration of the machine group.
Log on to the Log Service console, click the target project, and then click Logtail Machine Group in the left-side navigation pane. On the Machine Groups page, click Status in the Actions column of the target machine group.
If the server IP addresses configured in the machine group do not include the server IP address obtained by the Logtail client, you must to modify the IP address configuration.
If an incorrect server IP address is configured in the machine group, modify the IP address and save it. Then, check the heartbeat status again in 1 minute.
If you have modified the network configuration of the server where Logtail is installed, for example, /etc/hosts, you must restart Logtail to obtain the new server IP address. In addition, you must modify the server IP address configured in the machine group based on the
ipfield in the
sudo /etc/init.d/ilogtaild stop sudo /etc/init.d/ilogtaild start
- Windows: On Control Panel, choose , and then double-click Services. Find LogtailWorker and restart it.
If the server IP address obtained by the Logtail client is configured in the machine group, go to the next step.
4. Check whether an AliUid is configured for the ECS instance under another Alibaba Cloud account
If your ECS instance and Log Service project belong to different Alibaba Cloud accounts, or you use a server deployed in an on-premises IDC or provided by another cloud product vendor, you must configure an AliUid to authorize the server where Logtail is installed.
Check whether a file named after your AliUid exists in the /etc/ilogtail/users directory.
If such a file does not exist, configure an AliUid. For more information, see Configure AliUids for ECS servers under other Alibaba Cloud accounts or on-premises IDCs.
The AliUid must be an Alibaba Cloud account ID.
You can view your Alibaba Cloud account ID in the Alibaba Cloud console as follows: Move the point over your avatar and choose User Info > Security Settings.
If the problem persists, submit a ticket to Log Service engineers. Along with the ticket, provide the information about your project, Logstore, and machine group, the app_info.json and ilogtail_config.json files, and the output of the Logtail automatic diagnostic tool.