If no heartbeats are detected in a Logtail machine group when you use Logtail to collect logs, you can troubleshoot the error manually or by using the Logtail automatic diagnostic tool. A Logtail machine group contains servers on which Logtail is installed. This topic describes how to troubleshoot the error if a Logtail machine group has no heartbeats.

Troubleshooting process

If you use Logtail to collect logs, Logtail sends heartbeat packets to Log Service at a scheduled time after Logtail is installed on a server. If no heartbeats are detected in the machine group to which the server belongs, the connection between Logtail and Log Service fails. Log Service provides automatic and manual diagnostic methods. You can select a method based on your business requirements.
  • Automatic diagnostics: Log Service provides the Logtail automatic diagnostic tool. You can select this method only if Logtail is installed on Linux servers. For more information, see How do I use the Logtail automatic diagnostic tool?
  • Manual diagnostics: If the Logtail automatic diagnostic tool fails to identify the root cause of the error or Logtail is installed on a Windows server, perform the following steps.
Troubleshooting method

Step 1: Check whether Logtail is installed

View the status of Logtail to check whether Logtail is installed on a server.

  • Linux:

    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
  • Windows:
    1. Open the Run window and enter services.msc to open the Services window.
    2. View the status of the LogtailDaemon and LogtailWorker services.

      If the services are in the Running state, Logtail is installed.

Proceed based on the check results.

Step 2: Check whether the Logtail installation parameters are correctly configured

When you install Logtail, you must specify a correct Log Service endpoint for Logtail to connect to Log Service. You must enter the name of the region where your project resides and select the installation method based on the network type. For more information about region names, see Region names for Logtail installation. For more information about network types, see Select a network type. If the installation parameters are incorrectly configured or the Logtail installation script is invalid, heartbeats may not be detected on the server on which Logtail is installed. For more information about Log Service endpoints for different regions, see Endpoints.

The Logtail configuration file ilogtail_config.json contains the Logtail installation parameters and the installation method. The following list describes the paths to the file:
  • Linux: /usr/local/ilogtail/ilogtail_config.json
  • 64-bit Windows: C:\Program Files (x86)\Alibaba\Logtail\ilogtail_config.json
  • 32-bit Windows: C:\Program Files\Alibaba\Logtail\ilogtail_config.json
  1. Check whether the region of the Log Service endpoint that is used by Logtail is the same as the region of your project in the ilogtail_config.json file.
    1. Run the following command on your server to view the region of the Log Service endpoint that is used by Logtail:
      cat /usr/local/ilogtail/ilogtail_config.json

      The following information is returned, which indicates that Logtail is installed on an Elastic Compute Service (ECS) instance in the China (Hangzhou) region.

      Check installation parameters
    2. View the region of your project in the Log Service console.
      Region
  2. View the endpoint that is specified in the ilogtail_config.json file and check whether the selected installation method is correct based on the network type of your server.
    For example, the endpoint cn-hangzhou-intranet.log.aliyuncs.com is specified in the ilogtail_config.json file.
    • Linux:
      Run the following command to test the network connectivity:
      curl logtail.cn-hangzhou-intranet.log.aliyuncs.com

      If information similar to the following example is returned, the network is connected:

      null
    • Windows:
      Run the following command to test the network connectivity:
      telnet logtail.cn-hangzhou-intranet.log.aliyuncs.com 80

      If information similar to the following example is returned, the network is connected:

      Trying 100*0*7*5...
      Connected to logtail.cn-hangzhou-intranet.log.aliyuncs.com.
      Escape character is '^]'. 
  • If the check fails, the installation parameters are incorrectly configured. The system displays a message indicating that an incorrect installation command is used. In this case, you must reconfigure the installation parameters. For more information, see Install Logtail on a Linux server or Install Logtail on a Windows server.
  • If the installation parameters are correctly configured, proceed to the next step.

Step 3: Check whether the IP address that is specified in the machine group is correct

The server IP address that is obtained by Logtail must be the same as the IP address that is specified in the machine group. Otherwise, the machine group has no heartbeats, or logs cannot be collected. Logtail obtains a server IP address by using the following methods:
  • If the hostname of the server is not bound to an IP address, Logtail obtains the IP address of the first network interface controller (NIC) card of the server.
  • If the hostname of the server is bound to an IP address, Logtail obtains the IP address. You can view the hostname and IP address in the /etc/hosts file.
    Note You can obtain a hostname from the hostname field.
  1. View the server IP address that is obtained by Logtail.
    The ip field in the app_info.json file records the server IP address that is obtained by Logtail. The following list describes the paths to the file:
    • Linux: /usr/local/ilogtail/app_info.json
    • 64-bit Windows: C:\Program Files (x86)\Alibaba\Logtail\app_info.json
    • 32-bit Windows: C:\Program Files\Alibaba\Logtail\app_info.json
    Notice
    • If the ip field in the app_info.json file is empty, Logtail cannot work. In this case, you must configure an IP address for the server and restart Logtail.
    • The app_info.json file is used only to record information. If you specify the IP address in the file, the server IP address that is obtained by Logtail is not updated.
    View the server IP address that is obtained by Logtail
  2. View the IP address that is specified in the machine group.
    For more information, see Manage machine groups. Check machine group settings
  • If the IP address that is specified in the machine group is different from the IP address that is obtained by Logtail, change the IP address in the machine group.
    • If the IP address that is specified in the machine group is incorrect, change the IP address in the machine group. Wait 1 minute before you check the heartbeat status of the machine group.
    • If you change the network configurations of the server on which Logtail is installed, restart Logtail to update the IP address that is obtained by Logtail. For example, you can modify the /etc/hosts file to change the network configurations. Then, change the IP address in the machine groups to the value of the ip field in the app_info.json file. You can restart Logtail by using the following methods:
      • Linux:
        sudo /etc/init.d/ilogtaild stop
        sudo /etc/init.d/ilogtaild start
      • Windows:
        1. Open the Run window and enter services.msc to open the Services window.
        2. Restart the LogtailWorker service.
  • If the IP address that is specified in the machine group is the same as the server IP address that is obtained by Logtail, proceed to the next step.

Step 4: Check whether a user identifier is configured

If your server is an ECS instance that belongs to a different Alibaba Cloud account than Log Service, a server from a third-party cloud service provider, or an on-premises server in a data center, you must specify the ID of the Alibaba Cloud account to which Log Service belongs as a user identifier for your server after you install Logtail on your server. This way, Logtail is authorized to collect logs from your server across different accounts. For more information, see Configure a user identifier.

Check whether a file named after the ID of the Alibaba Cloud account to which Log Service belongs exists in the /etc/ilogtail/users directory.
  • If yes, the user identifier is configured.
  • If no, configure a user identifier. For more information, see Configure a user identifier.
Notice The user identifier must be the ID of an Alibaba Cloud account. For more information, see Obtain the ID of the Alibaba Cloud account to which Log Service belongs.

If the issue persists after you perform the preceding operations, submit a ticket and provide the information about your project, Logstore, and machine group. In addition, provide the app_info.json and ilogtail_config.json files as well as the output of the Logtail automatic diagnostic tool.