Overview

Configure the log collection function of Logtail in the log Service Console. If Machine Group heartbeat status of Logtail is abnormal, you can use the Logtail automatic diagnostic tool or manually troubleshoot the problem. This article describes how to troubleshoot a Logtail machine group without a heartbeat.

Description

This topic describes how to use Logtail to collect logs. After you install Logtail on your server, Logtail regularly sends heartbeat packets to the server. If the message no heartbeat exists on the machine Group page in the log service console, the connection between the client and log service fails. Log service uses the Logtail automatic diagnostic tool and manual diagnostic tool. You can select either of the following troubleshooting methods based on your requirements:
  • Automatic diagnosis: Log service provides the Logtail automatic diagnostic tool for Linux servers. For more information, see use the Logtail automatic diagnostic tool.
  • Manual diagnosis: If the Logtail automatic diagnostic tool fails to troubleshoot the error or your server is running a Windows system, check the error according to this topic.

  • The following figure shows the troubleshooting process when Logtail does not have a heartbeat.

Step 1: Check whether Logtail is installed

Follow these steps to check the status of Logtail.

  1. For Linux servers.
    • Run the following command to view the status of the Logtail service.
      sudo /etc/init.d/ilogtaild status
      If a similar output is displayed, Logtail is installed.
      ilogtail is running

  2. Windows servers.
    • Open the run window, enter services.msc to open the service window.
    • View LogtailDaemon or LogtailWorker the running status of the service. If the service is running, Logtail is installed.
      Instructions if the Logtail client is not installed, see install Logtail(Linux). Or install Logtail on a Windows ECS instance when you install log service, you must install log service based on the Region of your log service Project and the network type. If Logtail is running, follow these steps.

Step 2: Check whether the Logtail installation parameters are correct.

Before installing Logtail, you need to specify the correct network endpoint. Select the Logtail installation parameter based on the region of the log service Project. For more information, see install Logtail. Select an installation method based on network types. For more information, see network type. If the endpoint is incorrect or the Logtail installation command is invalid, Log Service cannot receive heartbeats from the Logtail client. For more information about service portals in different regions, see service entry. Logtail's ilogtail_config.json parameter the file records the Logtail installation parameter and the installation method that you used. The file path is as follows:

  • Linux server: /usr/local/ilogtail/ilogtail_config.json
  • Windows x64-bit servers: C:\Program Files (x86)\Alibaba\Logtail\ilogtail_config.json
  • Windows x86 bit server: C:\Program Files\Alibaba\Logtail\ilogtail_config.json
  1. Check the Logtail installation parameters.
    • In the Linux, run the following command, view the client is connected network entry the Region must be the same as the Region where your Project resides.
      cat /usr/local/ilogtail/ilogtail_config.json
      A similar output is displayed, indicating that Logtail is installed on the ECS instance in the China (Hangzhou) region.
      p21881.png
    • The following figure shows the region of the Project.
  2. To view the installation methods of Logtail, run test ilogtail_config.json file to see if the correct installation method is selected based on the network environment of your server. ilogtail_config.json file record the domain name configured by Logtail cn-hangzhou-intranet as an example.
    • For Linux servers.
      • Run the following commands, checks the connectivity of the network.
        curl logtail.cn-hangzhou-intranet.log.aliyuncs.com
        A similar output is displayed, indicating the network connectivity is normal.
        {"Error":{"Code":"OLSInvalidMethod","Message":"The script name is invalid : /","RequestId":"5DD39230BE9910FC6CF17609"}}
    • Windows servers.
      • Click start, input cmd, click confirm, and then open the command line tool.
      • Run the following commands, check the network connectivity.
        telnet logtail.cn-hangzhou-intranet.log.aliyuncs.com 80
        The system displays the following messages, indicating that the device has successfully connected to the platform.
        Trying 100*0*7*5...
        Connected to logtail.cn-hangzhou-intranet.log.aliyuncs.com.
        Escape character is '^]'. 
        Instructions if the check fails, install Logtail the installation command is incorrect. See install Logtail(Linux). Or install Logtail on a Windows ECS instance select the correct installation parameters. If Logtail is properly installed, perform the following steps for troubleshooting.

Step 3: Check whether the IP address configured for the machine Group is correct

The server IP address that is obtained by a Logtail client must be configured in the machine group. Otherwise, Log Service cannot receive heartbeats or collect logs from the Logtail client. The Logtail client obtains the machine IP address as follows:
  • If no hostname is bound to the machine, logtail reads the first network interface controller IP address of the server.
  • If the file /etc/hosts is set, the system reads the IP address corresponding to the bound host name.
  1. On a Linux server, run the following command to view the IP address obtained by The Logtail client.
    cat /usr/local/ilogtail/app_info.json
    The following command output is returned.

    Note:
    • If app_info.json file IP Logtail cannot work. In this case, you must configure an IP address for the server and restart Logtail.
    • app_info.json only records file usage. Modifying this file does not change the IP address obtained by Logtail.

  2. Login log Service Console and click the Project name. Click machine group, Select the name of the target machine group.
  3. In machine Group configurations page, view machine Group status if the IP address specified in the Machine Group at the server end is different from that obtained by the machine group at the client end, you must modify the IP address.

    Note:
    • If an incorrect IP address is configured on the server machine Group, modify the IP address in the Machine Group and save it. Then, check the heartbeat status again in 1 minute.
    • If the network configuration of the machine (such as /etc/hosts file), restart the Logtail service to obtain a new IP address, and follow the instructions in app_info.json in the file. ip modify the IP address in the Machine Group.
  4. Follow these steps to restart Logtail.
    • In a Linux server, run the following commands in sequence to restart Logtail.
      sudo /etc/init.d/ilogtaild stop 
      sudo /etc/init.d/ilogtaild start
    • In a Windows Server, open the run window and enter services.msc, click confirm. Open the service window and choose LogtailWorker services, click restart to restart the Logtail service.

Step 4: Check whether the Alibaba Cloud account ID is configured for the ECS instance under another 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 the Alibaba Cloud account ID on the server to authorize the server where Logtail is installed. For more information, see configure an Alibaba Cloud account ID. Please check /etc/ilogtail/users whether a file with the same name as your Alibaba Cloud account ID exists in the directory. If not, see configure an Alibaba Cloud account ID to perform operations.

Note:

  • 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 your problem is still not solved, please submit a ticket to log service. Provide the information of your Project, Logstore, Machine Group, app_info.json, ilogtail_config.json and output of the self-diagnostic tool.

Application scope

  • Log Service