Updated on 2022-02-22 GMT+08:00

Testing DIS Agent

Testing DIS Agent on a Linux Server

  1. Start PuTTY and log in to the server on which logs reside.
  2. Run the following command to navigate to the directory in which the DIS Agent stores logs:

    cd /opt/dis-agent-X.X.X/logs

  3. Run the following command to view logs:

    tail -100f dis-agent.log

    • If information similar to the following appears, the DIS Agent is running properly.
      Agent: Startup completed in xx ms
    • If any of the following information appears, the DIS Agent is not running properly and you need to troubleshoot the DIS Agent:
      • HttpClientErrorException: 400 Bad Request

        Possible cause: The value of DISStream or projectId in Configuring DIS Agent is incorrect.

        Solution: Stop the DIS Agent process and correct the parameter values.

      • HttpClientErrorException: 403 Forbidden

        Possible cause: The DIS gateway blacklists the IP address of the Linux server on which the DIS Agent is installed and consequently the request to view logs is blocked. Usually, the Linux server IP address is blacklisted because a DIS API is repeatedly called using incorrect configuration.

        Solution: Stop the DIS Agent process, modify the agent.yml file (see Configuring DIS Agent). Restart the DIS Agent process 30 minutes after it stops.

      • UnknownHttpStatusCodeException: Unknown status code [441]

        Possible cause: AK/SK configuration is incorrect.

        Solution: Stop the DIS Agent process and correct the AK/SK configuration.

      • ConnectTimeoutException: Connect to DOMAIN[DOMAIN/IP] failed: connect timed out

        Possible cause: The connection between the Linux server on which the DIS Agent is installed and the DIS gateway times out.

        Solution: Ensure that the Linux server on which the DIS Agent is installed can connect to the Internet.

  4. Check whether the DIS Agent can upload logs.

    • If the monitoring directory configured in agent.yml contains matched files, logs will record the information similar to the following, indicating that [N1 records (B1 bytes)/N2 files (B2 bytes)] are parsed and [N3 records/N4 files] are successfully uploaded.
      Agent: Progress: [N1 records (B1 bytes) / N2 files (B2 bytes)] parsed, and [N3 records / N4 files] sent successfully to destinations. Uptime: 30146ms
    • If no files match the filePattern, run the following command to generate log files required for testing log uploading:

      echo "`date` Hello world." >> /tmp/test.log

  5. Log in to the DIS console and view monitoring data of the DIS stream specified by the DISStream or CustomFileStream parameter in Configuring DIS Agent. If the stream monitoring data shows that data has been uploaded to the DIS stream, the DIS Agent has been successfully installed.

Testing DIS Agent on a Windows Server

  1. Use a file manager to navigate to the logs directory.
  2. Open the dis-agent.log file using an editor. View logs in the file.

    • If information similar to the following appears, the DIS Agent is running properly.
      Agent: Startup completed in xx ms
    • If any of the following information appears, the DIS Agent is not running properly and you need to troubleshoot the DIS Agent:
      • HttpClientErrorException: 400 Bad Request

        Possible cause: The value of DISStream or projectId in Configuring DIS Agent is incorrect.

        Solution: Stop the DIS Agent process and correct the parameter values.

      • HttpClientErrorException: 403 Forbidden

        Possible cause: The DIS gateway blacklists the IP address of the Linux server on which the DIS Agent is installed and consequently the request to view logs is blocked. Usually, the Linux server IP address is blacklisted because a DIS API is repeatedly called using incorrect configuration.

        Solution: Stop the DIS Agent process, modify the agent.yml file (see Configuring DIS Agent). Restart the DIS Agent process 30 minutes after it stops.

      • UnknownHttpStatusCodeException: Unknown status code [441]

        Possible cause: AK/SK configuration is incorrect.

        Solution: Stop the DIS Agent process and correct the AK/SK configuration.

      • ConnectTimeoutException: Connect to DOMAIN[DOMAIN/IP] failed: connect timed out

        Possible cause: The connection between the Linux server on which the DIS Agent is installed and the DIS gateway times out.

        Solution: Ensure that the Linux server on which the DIS Agent is installed can connect to the Internet.

  3. Check whether the DIS Agent can upload logs.

    • If the monitoring directory configured in agent.yml contains matched files, logs will record the information similar to the following, indicating that [N1 records (B1 bytes)/N2 files (B2 bytes)] are parsed and [N3 records/N4 files] are successfully uploaded.
      Agent: Progress: [N1 records (B1 bytes) / N2 files (B2 bytes)] parsed, and [N3 records / N4 files] sent successfully to destinations. Uptime: 30146ms
    • If no files match the filePattern, run the following command to generate log files required for testing log uploading:

      echo %date%time%Hello world. >> C:\test.log

  4. Log in to the DIS console and view monitoring data of the DIS stream specified by the DISStream or CustomFileStream parameter in Configuring DIS Agent. If the stream monitoring data shows that data has been uploaded to the DIS stream, the DIS Agent has been successfully installed.