If the heartbeat status of the Logtail machine group is abnormal when you use Logtail to collect logs, you can troubleshoot the problem through the Logtail auto-diagnosis tool or manually diagnose the problem.
- Automatic diagnosis: Log Service provides a Logtail auto-diagnosis tool that applies to Linux servers. For more information, see Logtail auto-diagnosis tool.
- Manual diagnosis: If the Logtail auto-diagnosis tool fails to troubleshoot the problem or your server is running on Windows, troubleshoot the problem by performing the following steps.
1. Check whether Logtail has been installed.
- In Linux:
sudo /etc/init.d/ilogtaild statusIf
ilogtail is runningis returned, Logtail has been installed. The following is an example:
[root@****************~]# sudo /etc/init.d/ilogtaild status ilogtail is running
- In Windows:
- In Control Panel, choose , and then open the Services program.
- Check the running status of LogtailDaemon, LogtailWorker, and Windows services. If they are running normally, Logtail has been installed successfully.
If Logtail is running, go to the next step.
2. Check whether Logtail installation parameters are correct?
Before installing Logtail, you need to specify the correct server access portal. That is, you must use correct Logtail installation parameters according to the region to which the Log Service project belongs and decide how to install Logtail according to the network type. Incorrect installation script or parameters can be a reason why the Logtail machine has no heartbeat.
- The /usr/local/ilogtail/ilogtail_config.json directory in Linux
- The C:\Program Files (x86)\Alibaba\Logtail\ilogtail_config.json directory in Windows x64
- The C:\Program Files\Alibaba\Logtail\ilogtail_config.json directory in Windows x32
- Check installation parameters.
Check whether the region of the network portal for Logtail client access in ilogtail_config.json is the same as the region to which the Log Service project belongs.
The returned information in the following figure indicates that Logtail is installed on an ECS server in the cn-hangzhou region.
- Check the installation method.
Use Telnet to test the domain name contained in ilogtail_config.json to check whether Logtail is correctly installed according to the server's network type.
For example, the domain name recorded in ilogtail_config.json is
cn-hangzhou-intranet. You can run
telnet logtail.cn-hangzhou-intranet.log.aliyuncs.com 80to check the network connectivity. If the Logtail client is connected to the server, Logtail has been correctly installed.You can check network connectivity between Logtail and a Linux ECS server by running the following command:
[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 preceding method fails, incorrect parameters were used during Logtail installation, as a result incorrect installation commands were executed. For information about correct installation parameters, see Install Logtail in Linux and Install Logtail in Windows.
If Logtail has been installed successfully, go to the next step.
3. Check whether the IP address of the machine group is correct.
The IP address configured for the machine group must be the server IP address obtained by Logtail. Otherwise, the machine has no heartbeat, or Logtail cannot collect logs.
Logtail obtains the machine IP address by using either of the following methods:
- If the server name is not attached to the machine, the IP address of the first NIC on the server will be used.
- If you have attached the server name to the machine in /etc/hosts, confirm the IP address to be attached. Then, you can run
hostnameto view the server name.
- Check the IP address obtained by Logtail.
ipfield in the app_info.json file specifies the IP address obtained by Logtail. The file is stored in:
- The /usr/local/ilogtail/app_info.json directory in Linux
- The C:\Program Files (x86)\Alibaba\Logtail\app_info.json directory in Windows x64
- The C:\Program Files\Alibaba\Logtail\app_info.json directory in Windows x32
- Logtail cannot work if the
ipfield is empty. In this case, you need to configure an IP address for the server and restart Logtail.
app_info.jsonfile only records information. Modifications to this file will not take effect on the IP address obtained by Logtail.
- On the Machine Groups page, click Status to check the IP address configured for the machine group.
If the IP address obtained by Logtail is not the machine group IP address, you need to modify the IP address.
- If an incorrect IP address is configured for the machine group, modify the IP address and save it. Wait for a minute, and then check the heartbeat status.
- If you have modified network configurations of the machine group, for example, /etc/hosts, you must restart Logtail to obtain the new IP address. Additionally, you need to modify the IP address configured for the machine group according to the
ipfield in the
- In Linux, run the following command:
sudo /etc/init.d/ilogtaild stop sudo /etc/init.d/ilogtaild start
- In Windows, choose Services program. Then, locate LogtailWorker and restart it. and open the
If the IP address obtained by Logtail is the one configured for the machine group, go to the next step.
4. Check whether an AliUid has been configured for the ECS server under another Alibaba Cloud account.
For ECS servers under other Alibaba Cloud accounts, servers provided by other cloud product vendors, and on-premises IDCs, you must configure AliUids for them to authorize the servers with Logtail installed.
Check whether a file named after your Alibaba Cloud account ID exists in the /etc/ilogtail/users directory.
If such a file does not exist, follow the instructions provided in Configure AliUids for ECS servers under other Alibaba Cloud accounts and on-premises IDCs.
- AliUids must be Alibaba Cloud account IDs.
- You can view your Alibaba Cloud account ID on the User Info page in the Alibaba Cloud console.
If the problem persists, open a ticket to submit the problem details to Log Service engineers. The ticket must contain information about your project, Logstore, machine group, app_info.json, ilogtail_config.json, and output of the auto-diagnosis tool.