Updated on 2024-05-14 GMT+08:00

Analyzing Logs

GaussDB allows you to download slow query logs, switchover/failover logs, and error logs. Slow query logs help you locate slow SQL statement execution problems. Error logs help you locate instance problems. If switchover/failover log collection is enabled for an instance whose Failover Priority is Availability, GaussDB can collect Xlogs that cannot be replayed on the standby node in time when a switchover or failover occurs and convert the Xlogs into a SQL file. You can download the SQL file and run SQL statements to replay the data in the SQL file as required.

Precautions

  • CNs and DNs of the instance are normal.
  • The underlying network is normal.
  • Switchover/Failover logs are available only for distributed instances whose Failover Priority is Availability.

Slow Query Logs

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.

  3. Click in the upper left corner of the page and choose Databases > GaussDB.
  4. On the Instances page, click the name of the target instance to go to the Basic Information page.
  5. In the navigation pane on the left, click Log Analysis.
  6. The system checks whether there has been a slow query log task in the last 5 minutes and, if there is not, generates one. Click the Slow Query Logs tab. Click Download in the Operation column of the record whose status is Preparation completed.

    After the log is downloaded, you can analyze the log on the local PC.

    Logs generated in the last 12 hours are collected for the analysis of slow query logs.

Error Logs

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.

  3. Click in the upper left corner of the page and choose Databases > GaussDB.
  4. On the Instances page, click the instance name to go to the Basic Information page.
  5. In the navigation pane on the left, click Log Analysis.
  6. On the displayed page, click the Error Logs page, enable Error Log Collection, and click Download in the Operation column of the record whose status is Preparation completed to download the error log file.

    After the log is downloaded, you can analyze the log on the local PC.

Switchover/Failover Logs

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.

  3. Click in the upper left corner of the page and choose Databases > GaussDB.
  4. On the Instances page, click the name of the target instance to go to the Basic Information page.
  5. In the navigation pane on the left, choose Log Analysis.
  6. On the displayed page, click the Switchover/Failover Logs page, enable Switchover/Failover Log Collection, and click Download in the Operation column of the record whose status is Preparation completed to download the switchover/failover log file.