OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Diagnostic Tool

V1.4.0
  • Overview
  • Install obdiag
  • Configure obdiag
  • Use `obdiag gather` commands to collect diagnostic information of OceanBase Database
  • Use `obdiag analyze` commands to analyze diagnostic information of OceanBase Database
  • Use `obdiag check` commands to inspect an OceanBase cluster
  • FAQ

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Diagnostic Tool
  3. V1.4.0

Use `obdiag analyze` commands to analyze diagnostic information of OceanBase Database

Last Updated:2026-09-04 08:22:11

analyze commands
Syntax
obdiag analyze log

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can use obdiag analyze commands to analyze diagnostic information of OceanBase Database. These commands allow you to analyze OceanBase Database logs to identify errors that have occurred.

If your OceanBase cluster is deployed by using OceanBase Deployer (OBD), you can run obdiag commands on OBD to collect diagnostic information of the cluster. For more information about the commands, see obdiag commands.

analyze commands

Syntax

obdiag analyze <gather type> [options]

Valid values of the analyze type parameter are as follows:

  • log: analyzes logs of the specified OceanBase cluster.

obdiag analyze log

You can run this command to analyze logs of the specified OceanBase cluster in online mode, or use the --files parameter to enable the offline analysis mode.

Note

  • In online analysis mode, the OceanBase cluster is in the running state, and the logs are distributed on each OBServer node.
  • In offline analysis mode, the command with the --files parameter collects the logs on the OBServer node to the server where obdiag is deployed.
  • Before you use this command, make sure that you have configured the logon information of the target nodes in the config.yml configuration file of obdiag. For more information, see Configure obdiag.
obdiag analyze log [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--from No string Empty The start time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the start time as1970-01-01 12:00:00.
--to No string Empty The end time for log collection in the yyyy-mm-dd hh:mm:ss format. The double quotation marks (") are not required. For example, you can set the end time as 1970-01-01 13:00:00.
--since No string Empty The most recent period for which logs are collected, in the \<n> <m\|h\|d>format, where n is a number, m indicates minutes, h indicates hours, and d indicates days. For example, 30m specifies to analyze logs of the last 30 minutes.
--scope No string all The type of logs to be analyzed. Valid values:observer, election, rootservice, and all.
--grep No string Empty The search keyword.
--ob_install_dir No string /home/admin The installation directory of OceanBase Database.
--store_dir No string Current path in which the command is executed The local path where the results are stored.
--log_level No string WARN The levels of the logs to be analyzed. Valid values: DEBUG, TRACE, INFO, WDIAG, WARN, EDIAG, and ERROR from high to low. Logs of the specified level and higher are analyzed.
--files No string Empty The offline log analysis mode. If you specify --files, you must transfer OceanBase logs or pass the log path for offline analysis, and you do not need to specify the --from, --to, --since, and --ob_install_dir options.
  • Example of online log analysis

    obdiag analyze log --scope observer --from 2023-10-08 10:25:00 --to 2023-10-08 11:30:00
    
    ...
    FileListInfo:
    +----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Node           | LogList                                                                                                                                                                                                               |
    +================+=======================================================================================================================================================================================================================+
    | xx.xx.xx.xx   | ['observer.log.20231008104204260', 'observer.log.20231008111305072', 'observer.log.20231008114410668', 'observer.log.wf.20231008104204260', 'observer.log.wf.20231008111305072', 'observer.log.wf.20231008114410668'] |
    +----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    ...
    
    
    Analyze OceanBase Online Log Summary:
    +----------------+-----------+------------------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | Node           | Status    | FileName                                                                     |   ErrorCode | Message                                                                                                                       |   Count |
    +================+===========+==============================================================================+=============+===============================================================================================================================+=========+
    | xx.xx.xx.xx    | Completed | analyze_pack_20231008171201/xx_xx_xx_xx/observer.log.20231008104204260       |       -5006 | You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use |       2 |
    +----------------+-----------+------------------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | xx.xx.xx.xx    | Completed | analyze_pack_20231008171201/xx_xx_xx_xx/observer.log.20231008111305072       |       -5006 | You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use |       8 |
    +----------------+-----------+------------------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | xx.xx.xx.xx    | Completed | analyze_pack_20231008171201/xx_xx_xx_xx/observer.log.20231008114410668       |       -5006 | You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use |      10 |
    +----------------+-----------+------------------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | xx.xx.xx.xx    | Completed | analyze_pack_20231008171201/xx_xx_xx_xx/observer.log.20231008114410668       |       -4009 | IO error                                                                                                                      |      20 |
    +----------------+-----------+------------------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    For more details, please run cmd 'cat analyze_pack_20231008171201/result_details.txt'
    
    • Analyze logs of the most recent period:

      # Analyze the logs of the last hour in online mode. When this command is executed, the logs of the last hour are pulled from the remote host for analysis and error diagnosis.
      obdiag gather log --scope observer --since 1h
      
      
      # Analyze the logs of the last 30 minutes in online mode. When this command is executed, the logs of the last 30 minutes are pulled from the remote host for analysis and error diagnosis.
      obdiag analyze log --scope observer --since 30m
      
  • Example of offline log analysis

    $ ls -lh test/
    -rw-r--r--  1 admin  staff   256M Oct  8 17:24 observer.log.20231008104204260
    -rw-r--r--  1 admin  staff   256M Oct  8 17:24 observer.log.20231008111305072
    -rw-r--r--  1 admin  staff   256M Oct  8 17:24 observer.log.20231008114410668
    -rw-r--r--  1 admin  staff    18K Oct  8 17:24 observer.log.wf.20231008104204260
    -rw-r--r--  1 admin  staff    19K Oct  8 17:24 observer.log.wf.20231008111305072
    -rw-r--r--  1 admin  staff    18K Oct  8 17:24 observer.log.wf.20231008114410668
    
    $ obdiag analyze log --files test/
    
    Analyze OceanBase Offline Log Summary:
    +-----------+-----------+-----------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | Node      | Status    | FileName                                                              |   ErrorCode | Message                                                                                                                       |   Count |
    +===========+===========+=======================================================================+=============+===============================================================================================================================+=========+
    | 127.0.0.1 | Completed | analyze_pack_20231008172144/127_0_0_1_/observer.log.20231008104204260 |       -5006 | You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use |       2 |
    +-----------+-----------+-----------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | 127.0.0.1 | Completed | analyze_pack_20231008172144/127_0_0_1_/observer.log.20231008111305072 |       -5006 | You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use |       8 |
    +-----------+-----------+-----------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | 127.0.0.1 | Completed | analyze_pack_20231008172144/127_0_0_1_/observer.log.20231008114410668 |       -5006 | You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use |      10 |
    +-----------+-----------+-----------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    | 127.0.0.1 | Completed | analyze_pack_20231008172144/127_0_0_1_/observer.log.20231008114410668 |       -4009 | IO error                                                                                                                      |      20 |
    +-----------+-----------+-----------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------------------------------------------+---------+
    For more details, please run cmd 'cat analyze_pack_20231008172144/result_details.txt'
    
    • Offline analysis of logs on a specified OBServer node:

      # Analyze the specified log file in offline mode
      obdiag analyze log --files observer.log.20230831142211247
      

Previous topic

Use `obdiag gather` commands to collect diagnostic information of OceanBase Database
Last

Next topic

Use `obdiag check` commands to inspect an OceanBase cluster
Next
on this page
analyze commands
Syntax
obdiag analyze log