This topic describes how to troubleshoot the issue that the heartbeat status of a machine group is FAIL because no IP addresses are recorded in the app_info.json file of Logtail.
Problem description
The heartbeat detection configuration of a machine group in the Simple Log Service console failed. The troubleshooting results show that no IP addresses are recorded in the app_info.json
file.
Logic of obtaining an IP address
Logtail obtains the IP address from a server to the app_info.json
file based on the following logic:
Access the
/etc/hosts
file on the server and obtain the IP address from the parsing record of the hostname.If the first network interface controller (NIC) card of the server is not found and the
/etc/hosts
file does not contain the parsing record of the hostname, the ip field in theapp_info.json
file is empty.If the
/etc/hosts
file does not contain the parsing record of the hostname, Logtail obtains the IP address of the first NIC card of the server.
Solution
Connect to a Linux instance in remote mode. For more information, see Connect to a Linux instance by using an SSH key pair.
Run the following command to obtain the hostname of the instance:
hostname
Run the following command to edit the
/etc/hosts
file:sudo vi /etc/hosts
Add the parsing record of the hostname.
${Host IP address} ${Hostname}
Press the
Esc
key on your keyboard. Then, enter:wq
and press theEnter
key.Run the following command to check whether the parsing record takes effect:
ping ${Hostname}