Overview

When an exception occurs on a log collection in the log service console, you can use the Logtail automatic diagnostic tool to check whether the exception exists on the Logtail client and quickly locate and solve the problem as instructed in the tool. This article describes how to use the quick diagnostic tool of Logtail.

Description

Startup of the diagnostic tool

Instructions currently, this tool only supports Linux servers.

  1. By remote connection log on to the Linux instance. 
  2. Run the following command to download the image compliance tool script.
    wget http://logtail-release.oss-cn-hangzhou.aliyuncs.com/linux64/checkingtool.sh -O checkingtool.sh
    If the download fails, run the following command to use the alternate download address.
    wget http://logtail-corp.oss-cn-hangzhou-zmf.aliyuncs.com/linux64/checkingtool.sh -O checkingtool.sh
  3. The curl tool must be installed on the server to check network connectivity.
  4. Run the following commands in sequence to run the diagnostic tool.
    chmod 744 ./checkingtool.sh
    ./checkingtool.sh
    sh checkingtool.sh
    The system output is similar to the following. Follow the prompts to enter 1or 2the script will perform different check processes according to your selections.
    [Info]:     Logtail checking tool version : 0.3.0
    [Input]:  please choose which item you want to check :
                 1. MachineGroup heartbeat fail.
                 2. MachineGroup heartbeat is ok, but log files have not been collected.
         Item :
    Note:
    • 1 indicates the machine group heartbeat check. Select this Machine Group when the heartbeat status is set to 1.
    • 2 indicates the log collection check. Select this option machine group the heartbeat status is normal but log files are not collected.

Diagnostic tool process

After you select one of the preceding check items, the diagnostic tool automatically performs the corresponding check. The following figure shows the automatic execution process.

Machine group heartbeat check

After you select Machine Group heartbeat check, the system checks the following items:

  1. Check the basic environment.
    • Check whether Logtail is installed.

    • Check whether Logtail is running.

    • Whether the SSL status is normal.

    • Whether the network connection between Machine Group and log service is normal.

    [Info]:     Logtail checking tool version : 0.3.0
    [Input]:  please choose which item you want to check :
                    1. MachineGroup heartbeat fail.
                    2. MachineGroup heartbeat is ok, but log files have not been collected.
            Item :1
    [Info]:     Check logtail install files
    [Info]:     Install file: ilogtail_config.json exists.                          [ OK ]
    [Info]:     Install file: /etc/init.d/ilogtaild exists.                         [ OK ]
    [Info]:     Install file: ilogtail exists.                                      [ OK ]
    [Info]:     Bin file: /usr/local/ilogtail/ilogtail_0.14.2 exists.               [ OK ]
    [Info]:     Logtail version :                                                   [ OK ]
    [Info]:     Check logtail running status
    [Info]:     Logtail is runnings.                                                [ OK ]
    [Info]:     Check network status
    [Info]:     Logtail is using ip: 11.XX.XX.187
    [Info]:     Logtail is using UUID: 0DF18E97-0F2D-486F-B77F-XXXXXXXXXXXX
    [Info]:     Check SSL status
    [Info]:     SSL status OK.                                                      [ OK ]
    [Info]:     Check logtail config server
    [Info]:     config server address: http://config.sls.aliyun-inc.com
    [Info]:     Logtail config server OK
    Instructions if the check appears Error for more information, see the prompt.
  2. After checking the basic environment, make sure that your server is an ECS instance. You can use your Alibaba Cloud account to purchase the ECS instance. If this server is not an ECS instance, or its log service account is different from your account, enter Y, otherwise enter N.
    [Input]: Is your server non-Alibaba Cloud ECS or not belong to the same account with the current Project of Log Service ? (y/N)

    When input Y the tool will output the AliUid information configured on the local server. Check whether the AliUid is included. For more information, see create an AliUid.

    [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
    [Info]:     Check aliyun user id(s)
    [Info]:     aliyun user id : 126XXXXXXXXXX79 .                                 [ OK ]
    [Info]:     aliyun user id : 165XXXXXXXXXX50 .                                 [ OK ]
    [Info]:     aliyun user id : 189XXXXXXXXXX57 .                                 [ OK ]
    [Input]:  Is your project owner account ID is the above IDs ? (y/N)
  3. Check Region. Check whether the Region of your Project is the same as that selected when you installed Logtail. If not, see reinstall Logtail..
    [Input]: please make sure your project is in this region : { cn-hangzhou } (y/N) :
  4. Check the IP address configuration. Make sure the IP address configured in Machine Group is the same as the IP address Machine Group by Logtail. If not, see IP address Machine Group.
    [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) :
    Instructions if your identity Machine Group is configured, check whether the identity configured on your local PC is the same as that configured on the server. If not, see custom identity Machine Group.

Log collection check

After you select the log collection check, the system checks the following items:
  1. Check whether the IP address configured for the machine Group is the same as that machine group by the Logtail client, and whether the heartbeat status is normal. If not, see modify Machine Group.
    [Input]:  please make sure your machine group's ip is same with : { 11.XX.XX.187 } (y/N) :
  2. Verify that your collection configuration is applied to the Machine Group. For more information about how to check Machine Group application configuration, see manage Machine Group.
    [Input]: please make sure you have applied collection config to the machine group (y/N) :Y
  3. Enter the log file path that you want to check. Check whether this log file path is a matching log file. If the Logtail configuration is incorrect, modify the configuration and save it. Run the script again in 1 minute to check this item for a second time.

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

Persisted exception after all checks

If the logtail client passes all the checks but still fails to collect logs, enter the following information in the last selection of the script: Y and use the the Enter key to confirm. Will check the output of the script as an attachment, please submit a ticket to log service.

[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. You can encapsulate and customize a quick check script. When the quick check is run, the AliUid, dynamically Machine Group and custom Identifiers. If the identifier does not exist, no alert is triggered. If the client needs to configure AliUid, dynamic Machine Group, and custom identity, check whether the output of the tool is consistent with your configuration. If not, see create an AliUid and custom identity Machine Group .

Run the following command to check the log file. If an exception is found in the detection script, follow the script prompts to handle the exception.

Instructions if the Logtail client passes the specified log file check and the Logtail running environment is normal, we recommend that you log on to the log service console to view the configuration items exception logs. For more information, see diagnostic collection errors.

./checkingtool.sh --logFile [$LogFileFullPath]

The following command output is returned.

Instructions [$LogFileFullPath] is the log file path.

Common Logtail collection errors

After running the Logtail automatic diagnostic tool, you can identify the causes of Logtail collection errors, and then use an appropriate solution to resolve the error accordingly. Common Logtail collection errors and corresponding solutions are as follows:

FAQ Solutions
Installation files are incomplete. Please reinstall Logtail.
Logtail is not running. In the server, execute /etc/init.d/ilogtaild start command to enable Logtail.
Multiple Logtail processes exist.

On the server, run the following commands in sequence to restart Logtail.

/etc/init.d/ilogtaild stop

/etc/init.d/ilogtaild start

Port 443 is disabled. Configure the firewall to enable port 443.
The configuration server cannot be found. Check whether Logtail is correctly installed. If not, reinstall Logtail. For more information, see configure Logtail in Linux.
The user configuration does not exist. Check whether the following operations are performed:
  1. A Logtail configuration is created in the log service console.
  2. The server is included in a machine group.
  3. The Logtail configuration is applied to the machine group.
The specified log file cannot be matched. Check whether the Logtail configuration is correct.
The specified log file is matched more than once. Logtail selects a Logtail configuration randomly if you match the specified log file multiple times. We recommend that you keep only one Logtail configuration that matches the specified log file.

Common parameters for the diagnostic tool

 
Common options Description
--help Views the help documentation.
--logFile [LogFileFullPath] Check whether Logtail collects logs in LogFileFullPath at the same time check the basic Logtail running environment (installation file integrity, running status, AliUid, network connectivity).
--logFileOnly [LogFileFullPath] Only checks whether Logtail collects logs from LogFileFullPath.
--envOnly Only checks the running environment of Logtail.

Application scope

  • Log Service