All Products
Search
Document Center

Logtail quick diagnosis tool

Last Updated: Jan 09, 2019

If an exception occurs during the log collection, you can use the Logtail automatic diagnosis tool to check whether an exception exists in the client and quickly locate and solve problems based on tool tips.

Note: Currently, only Linux system is supported.

Preparations

  1. Download the diagnosis tool script.

    • wget http://logtail-release.oss-cn-hangzhou.aliyuncs.com/linux64/checkingtool.sh -O checkingtool.sh

    • wget http://logtail-corp.oss-cn-hangzhou-zmf.aliyuncs.com/linux64/checkingtool.sh -O checkingtool.sh

  2. Install the curl tool. The diagnosis tool use curl for network connectivity checks. Make sure the machine has the curl tool installed.

Run the diagnosis tool

  1. Execute the following command to run the diagnosis tool:

    1. chmod 744 ./checkingtool.sh
    2. ./checkingtool.sh
    3. sh checkingtool.sh

    The returned information is as follows:

    1. [Info]: Logtail checking tool version : 0.3.0
    2. [Input]: please choose which item you want to check :
    3. 1. MachineGroup heartbeat fail.
    4. 2. MachineGroup heartbeat is ok, but log files have not been collected.
    5. Item :
  2. Enter 1 or 2 as prompted. The script performs different checks based on your choice.

    Wherein:

    • 1. The machine group heartbeat check is performed. Select this option if the heartbeat of the machine group fails.
    • 2. The log collection check is performed. Select this option, if the machine group heartbeat is normal but the log files are not collected.

    After selecting the required option, the diagnosis tool automatically performs the corresponding check.

The diagnosis process

tool

Machine group heartbeat check

After selecting the machine group heartbeat check, the following checks are performed.

1. Basic environment check

  • Whether Logtail is installed.

  • Whether Logtail is run.

  • Whether SSL status is normal.

  • Whether the network connection with Log Service is normal.

  1. [Info]: Logtail checking tool version : 0.3.0
  2. [Input]: please choose which item you want to check :
  3. 1. MachineGroup heartbeat fail.
  4. 2. MachineGroup heartbeat is ok, but log files have not been collected.
  5. Item :1
  6. [Info]: Check logtail install files
  7. [Info]: Install file: ilogtail_config.json exists. [ OK ]
  8. [Info]: Install file: /etc/init.d/ilogtaild exists. [ OK ]
  9. [Info]: Install file: ilogtail exists. [ OK ]
  10. [Info]: Bin file: /usr/local/ilogtail/ilogtail_0.14.2 exists. [ OK ]
  11. [Info]: Logtail version : [ OK ]
  12. [Info]: Check logtail running status
  13. [Info]: Logtail is runnings. [ OK ]
  14. [Info]: Check network status
  15. [Info]: Logtail is using ip: 11.XX.XX.187
  16. [Info]: Logtail is using UUID: 0DF18E97-0F2D-486F-B77F-XXXXXXXXXXXX
  17. [Info]: Check SSL status
  18. [Info]: SSL status OK. [ OK ]
  19. [Info]: Check logtail config server
  20. [Info]: config server address: http://config.sls.aliyun-inc.com
  21. [Info]: Logtail config server OK [ OK ]

If there the Error message occurs during the check, follow the prompts for processing.

2. Confirm whether it is non-current account ECS

After the basic environment check, confirm whether your server is current account ECS.

If the server is not ECS or purchase ECS account and Log Service account are different, enter y, otherwise enter N.

  1. [Input]: Is your server non-Alibaba Cloud ECS or not belong to the same account with the current Project of Log Service ? (y/N)

After entering y, the check tool returns the Alibaba Cloud ID information of the local configuration. Confirm whether it contains your Alibaba Cloud ID, if not, see Collect logs from non-Alibaba Cloud ECS instances or ECS instances not in your account.

  1. [Input]: Is your server non-Alibaba Cloud ECS or not belong to the same account with the current Project of Log Service ? (y/N)y
  2. [Info]: Check aliyun user id(s)
  3. [Info]: aliyun user id : 126XXXXXXXXXX79 . [ OK ]
  4. [Info]: aliyun user id : 165XXXXXXXXXX50 . [ OK ]
  5. [Info]: aliyun user id : 189XXXXXXXXXX57 . [ OK ]
  6. [Input]: Is your project owner account ID is the above IDs ? (y/N)

3. Check the region

Check whether the region of your project is the same as the region selected during Logtail installation, if not Reinstall Logtail.

  1. [Input]: please make sure your project is in this region : { cn-hangzhou } (y/N) :

4. Check the IP configuration

Confirm whether the IP configuration of your machine group is consistent with the Logtail IP, if not, see Manage a machine group to modify.

  1. [Input]: please make sure your machine group's ip is same with : { 11.XX.XX.187 } or your machine group's userdefined-id is in : { XX-XXXXX } (y/N) :

Log collection check

After selecting the log collection check, the following checks are performed.

1. Check the IP configuration

Confirm whether the IP configuration of your machine group is consistent with the Logtail IP, and the heartbeat is normal, if not, see Manage a machine group.

  1. [Input]: please make sure your machine group's ip is same with : { 11.XX.XX.187 } (y/N) :

2. Check collection configuration application

Confirm whether your collection configuration has been applied to this machine group. For more information abouot how to view the machine group configuration, see Manage a collection configuration.

  1. [Input]: please make sure you have applied collection config to the machine group (y/N) :Y

3. Сheck log files

During the check enter the Full path of log file you want to check. If no match is found, confirm that the configured path information matches the log file.

If the configuration is incorrect, edit the collection configuration and save it. One minute later, run the script again to check.

  1. [Input]: please input your log file's full path (eg. /var/log/nginx/access.log) :/disk2/logs/access.log
  2. [Info]: Check specific log file
  3. [Info]: Check if specific log file [ /disk2/logs/access.log ] is included by user config.
  4. [Warning]: Specific log file doesnt exist. [ Warning ]
  5. [Info]: Matched config found: [ OK ]
  6. [Info]: [Project] -> sls-zc-xxxxxx
  7. [Info]: [Logstore] -> release-xxxxxxx
  8. [Info]: [LogPath] -> /disk2/logs
  9. [Info]: [FilePattern] -> *.log

Check is successful but collection is still abnormal

If all the checks are passed, but the collection is still abnormal, enter y in the script and press Enter to confirm.

Add the output of the script as an attachment and open a ticket to contact Alibaba Cloud technical support.

  1. [Input]: please make sure all the check items above have passed. If the problem persists, please copy all the outputs and submit a ticket in the ticket system. : (y/N)y

Quick check

The quick check runs without confirmation and can be used for secondary package custom script check.

Note: The Alibaba Cloud ID and dynamic machine group/user-defined identity configured in the client are output when the diagnosis tool is running. No alarm is triggered if they do not exist. If the client requires the configuration of Alibaba Cloud ID or dynamic machine group/user-defined identity, check if the output of the tool and your configuration are the same. If not, reconfigure them as described in Collect logs from non-Alibaba Cloud ECS instances or ECS instances not in your account and Configure a user-defined identity for a machine group.

Procedure

Run the script ./checkingtool.sh --logFile [LogFileFullPath] to perform the check. If the script detects an exception, proceed as instructed by the script.

52578-2cn

Note: If the specific log file passes the check and the Logtail running environment is normal, we recommend that you log on to the Alibaba Cloud console to view the configuration exception logs of Log Service. For more information, see Query log collection errors.

Common Logtail log collection errors

You can find the causes of Logtail log collection errors by running the Logtail quick diagnosis tool and then use the corresponding solution to solve the problem. The solutions of common Logtail log collection errors are as follow.

Cause Solution
Installation file is missing Reinstall Logtail.
Logtail is not running Run the /etc/init.d/ilogtaild start command to start Logtail.
Multiple Logtail processes Run the /etc/init.d/ilogtaild stop command to stop Logtail, and then run the /etc/init.d/ilogtaild start command to start Logtail.
Port 443 is disabled Open the port 443 in the firewall.
Cannot find the configuration server Check whether the installation is correct. If not, uninstall and then reinstall Logtail.
User configuration does not exist Confirm that the following operations have been performed:
  1. The Logtail configuration is created in the console.
  2. The server is included in the machine group.
  3. The configuration is applied to the machine group.
The specified log file is not matched Check whether the Logtail configuration is correct.
The specified log file is matched more than once Logtail selects one configuration randomly when multiple matches exist. We recommend that you retain only one configuration that matches the specified log file.

Common parameters for the diagnosis tool

  • --help: View help document.
  • --logFile [LogFileFullPath]: Check if Logtail collects logs from LogFileFullPath and check the basic running environment of Logtail such as installation file integrity, running status, Alibaba Cloud user ID, and network connectivity.
  • --logFileOnly [LogFileFullPath]: Only check if Logtail collects logs from LogFileFullPath.
  • --envOnly: Only check the running environment of Logtail.