Jianghu Panel - Common Logs

12006

Learning Objectives

  • Site Log Analysis: Understand how to locate site logs and resolve common issues.
  • Eggjs Program Log Analysis: Master how to locate Eggjs program logs and resolve common issues.
  • MySQL Log Analysis: Learn how to locate MySQL logs and resolve common issues.

1. Site Log Analysis

  1. Log Location: In the Jianghu Panel, you can click on the specified site, and in the site panel under "Response Logs" and "Error Logs," you can view the logs for the current site.
  2. Common Issues and Solutions:
    • 404 Error: Usually indicates that the requested resource does not exist. Check if the requested URL is correct or if the resource actually exists on the server.
    • 500 Error: Usually indicates an internal server error. Check the log details; it may be a server configuration issue or a backend code issue.
    • 403 Error: Usually indicates that there is no permission to access the requested resource. Check the server's permission settings.

2. JianghuJS Program Log Analysis

  1. Log Location: The JianghuJS framework automatically prints some logs for us, and these log files are stored in the project's logs directory by default.
  2. Common Issues and Solutions:
    • Program Logs: The runtime logs of the JianghuJS program are recorded in the project-name-web.log file (e.g., jianghujs-1table-crud-web.log).
    • Error Logs: If the program encounters an error, the error stack information is recorded in the common-error.log file. By checking this file, you can locate where the error occurred.
    • Request Logs: Each request is recorded in the access.log file. If there are abnormal requests, you can find relevant information here.

3. MySQL Log Analysis

  1. Log Location: The MySQL log files installed through the Jianghu Panel are stored in the plugin's /www/server/mysql-apt/data/ directory, where error.log is the most commonly used log file. The error.log file can be opened directly in the MySQL plugin - Logs of the Jianghu Panel.
  2. Common Issues and Solutions:
    • Connection Errors: If the MySQL service fails to start or the client cannot connect to the service, you can check the error.log file to identify the cause of the problem.
    • Query Errors: If a specific SQL query fails, the error message is usually recorded in the error.log file.

4. Xtrabackup Log Analysis

  1. Log Location: The logs for the xtrabackup backup steps in the Jianghu Panel's Xtrabackup plugin and Xtrabackup incremental version plugin are stored in their respective main program directories. Other execution steps generate logs found under the task logs on the scheduled tasks page.
    • Xtrabackup: /www/server/xtrabackup/logs
    • Xtrabackup Incremental Version: /www/server/xtrabackup-inc/logs
  2. Common Issues and Solutions:
    • Xtrabackup log error indicates backup could not be completed, but the database is still usable: This is usually caused by corrupted database page files. You can use the panel script tool --> "4. Server Repair" --> "1. Repair Database Files" to check the erroneous data pages and attempt to repair them.
    • Scheduled task log shows "A task is already running, please try again later": This is usually due to two Xtrabackup backup tasks running simultaneously, with one task exceeding the maximum retry count. In this case, you can check the execution times of the full backups in the Xtrabackup plugin and incremental version plugin, and try to stagger the execution times of the two tasks.

5. Rsync Log Analysis

  1. Log Location: The real-time task logs and scheduled task logs of the Rsyncd plugin are stored in different directories:
    • Real-time Logs: /www/server/rsyncd/logs
    • Scheduled Logs: /www/server/rsyncd/send/<sync-task-name>/logs
  2. Common Issues and Solutions:
    • Synchronization task did not complete: The successful completion of a synchronization task is indicated by a summary of the synchronization process at the end of the log file, such as the amount of data sent/received, network speed, total file size, etc. If this information is not displayed, there may be several reasons:
      • SSH connection configuration error: Check if the task's IP address, port number, and SSH key are correctly configured.
      • Network connection issues: Check if the network between the target server is reachable, if the firewall has opened the corresponding ports and IPs, and also check if the Rsyncd task's speed limit is too low. After checking, try again.
    • Real-time synchronization log lsyncd.status shows synchronization task has delays: This may be due to too many tasks waiting to be synchronized. You can try using the systemctl restart lsyncd command to restart the lsyncd service.
    • Real-time synchronization monitoring file count exceeds the maximum limit: You can use the following commands to increase the file count limit monitored by the lsyncd service:
  echo 524288 | tee /proc/sys/fs/inotify/max_user_watches  
  echo fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf  
  sysctl -p  
  systemctl restart lsyncd  

6. Scheduled Task Log Analysis

  1. Log Location: Each scheduled task has a separate log record:
    • In the "Scheduled Tasks" page, you can view the logs for each scheduled task.
    • The log files for scheduled tasks are stored in the /www/server/cron directory.
  2. Common Issues and Solutions:
    • Let's Encrypt certificate renewal task error: If the task log does not show successful renewal information, you can run the panel script tool --> "4. Server Repair" --> "2. Repair Abnormal SSL Orders for Websites" to fix it.
    • Error "Scheduled task has stopped" in the log: If a scheduled task is manually stopped, and then re-enabled through the script tool, it may cause an error, leading the scheduled task page to display the task status as normal, but it is actually still stopped. You can try running the following command to fix it:
find /www/server/cron/ -type f -name '*_stopped' -delete  

Assignment

Based on the content of this article, analyze the following three types of logs and provide your solutions:

  • View the error log of a site in the Jianghu Panel.
  • View the execution log of a JianghuJS program.
  • Use the MySQL plugin of the Jianghu Panel to view the error log.