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 ServiceOceanBase DataPilot

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 ServiceOceanBase DataPilot
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Diagnostic Tool

V2.4.0
  • Overview
  • Install obdiag
  • Configure obdiag
  • One-click Cluster Inspection
    • Use obdiag to inspect an OceanBase cluster
    • Inspection metrics
  • One-click Information Collection
    • One-click General Information Collection
      • obdiag gather log
      • obdiag gather sysstat
      • obdiag gather plan_monitor
      • obdiag gather stack
      • obdiag gather perf
      • obdiag gather ash
      • obdiag gather tabledump
      • obdiag gather parameter
      • obdiag gather variable
      • obdiag gather clog/obdiag gather slog
      • obdiag gather obproxy_log
      • obdiag gather all
    • One-click Scenario-based Information Collection
      • Overview
      • observer.base
      • observer.backup
      • observer.backup_clean
      • observer.clog_disk_full
      • observer.cluster_down
      • observer.compaction
      • observer.cpu_high
      • observer.delay_of_primary_and_backup
      • observer.io
      • observer.log_archive
      • observer.long_transaction
      • observer.memory
      • observer.perf_sql
      • observer.px_collect_log
      • observer.recovery
      • observer.restart
      • observer.rootservice_switch
      • observer.suspend_transaction
      • observer.unit_data_imbalance
      • observer.perf_sql
      • other.application_error
      • obproxy.restart
      • observer.unknown
  • One-click Diagnostic Analysis
    • obdiag analyze log
    • obdiag analyze flt_trace
    • obdiag analyze parameter default
    • obdiag analyze parameter diff
    • obdiag analyze variable diff
    • obdiag analyze index_space
  • One-click Root Cause Analysis
    • Use obdiag for root cause analysis
    • disconnection
    • major_hold
    • lock_conflict
    • ddl_disk_full
    • clog_disk_full
    • log_error
    • ddl_failure
    • index_ddl_error
    • transaction_disconnection
    • transaction_execute_timeout
    • transaction_not_ending
    • transaction_other_error
    • transaction_rollback
    • transaction_wait_timeout
  • Upgrade obdiag by using add-on files
  • Upgrade and uninstall obdiag
  • Telemetry Mode
  • FAQ
  • Release Notes
    • obdiag V2.4.0
    • obdiag V2.3.0
    • obdiag V2.2.0
    • obdiag V2.1.0
    • obdiag V2.0.0
    • obdiag V1.6.2
    • obdiag V1.6.1
    • obdiag V1.6.0
    • obdiag V1.5.2
    • obdiag V1.5.1
    • obdiag V1.5.0
    • obdiag V1.4.0
    • obdiag V1.3.0

Download PDF

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

obdiag gather log

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

Syntax
Examples
Method 1: Use the command out-of-the-box without a configuration file
Method 2: Use the command with a configuration file
Results

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run this command to collect logs of the specified OceanBase cluster.

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.

Syntax

obdiag gather log [options]

The following table describes the options.

Option
Required?
Data type
Default value
Description
--from No string Empty The start time of log collection in the yyyy-mm-dd hh:mm:ss format.
--to No string Empty The end time of log collection in the yyyy-mm-dd hh:mm:ss format.
--since No string Empty The most recent period of time for log collection, in the format of <n> <m|h|d>, where n specifies the time value, m represents "minute", h represents "hour", and d represents "day". For example, 30m specifies to collect logs of the last 30 minutes.
--scope No string all The type of logs of the OceanBase cluster to be collected. Valid values: observer, election, rootservice, and all.
--grep No string Empty The search keyword.
--encrypt No string false Specifies whether to encrypt the returned files. Valid values: true and false.
--store_dir No string The current path where the command is executed The local path where the results are stored.
--temp_dir No string /tmp The directory where temporary files generated by the remote node during log collection are stored.
-c No string ~/.obdiag/config.yml The path of the configuration file.
--inner_config No string Empty The configurations of obdiag.
--config No string Empty The configurations of the cluster diagnosed by obdiag, in the format of --config key1=value1 --config key2=value2.

Examples

Method 1: Use the command out-of-the-box without a configuration file

Note

For more information about the parameters used in the command in this section, see Configure obdiag.

  • Collect logs of the specified period

    obdiag gather log --scope observer --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00" --grep STORAGE --encrypt true \
        --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
        --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \
        --config obcluster.servers.global.ssh_username=test \
        --config obcluster.servers.global.ssh_password=****** \
        --config obcluster.servers.global.home_path=/home/admin/oceanbase
    

    The output is as follows:

    ...
    ZipFileInfo:
    +-------------------+-----------+
    | Node              | LogSize   |
    +===================+===========+
    | xxx.xxx.xxx.xxx   | 36.184M   |
    +-------------------+-----------+
    ...
    
    ZipFileInfo:
    +-------------------+-----------+
    | Node              | LogSize   |
    +===================+===========+
    | xxx.xxx.xxx.xxx   | 44.176M   |
    +-------------------+-----------+
    ...
    
    Summary:
    +-------------------+-----------+----------+------------------+--------+-------------------------------------------------------------------------------+
    | Node              | Status    | Size     | Password         | Time   | PackPath                                                                      |
    +===================+===========+==========+==================+========+===============================================================================+
    | xxx.xxx.xxx.xxx   | Completed | 36.762M  | HYmVourcUyRNP8Om | 19 s   | obdiag_gather_pack_20220701183246/ob_log_xxx.xxx.xxx.xxx_20220701183247.zip   |
    +-------------------+-----------+----------+------------------+--------+-------------------------------------------------------------------------------+
    | xxx.xxx.xxx.xxx   | Completed | 638.200M | 1RicMaiLUUNfemnj | 718 s  | obdiag_gather_pack_20220701183246/ob_log_xxx.xxx.xxx.xxx_20220701183918.zip   |
    +-------------------+-----------+----------+------------------+--------+-------------------------------------------------------------------------------+
    

    Notice

    If encryption is enabled, collected logs are encrypted when being compressed. The value in the Password column indicates the password for decrypting the .zip package. Encryption is disabled by default.

  • Collect logs of a recent period

    # Collect logs of the last hour with the target nodes accessible to obdiag without a password.
    obdiag gather log --since 1h \
      --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
      --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \
      --config obcluster.servers.nodes[2].ip=xx.xx.xx.xx.3 \
      --config obcluster.servers.global.home_path=/home/admin/oceanbase
    
    # Collect logs of the last 30 minutes with the target nodes accessible to obdiag without a password.
    obdiag gather log --since 30m \
      --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
      --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \
      --config obcluster.servers.nodes[2].ip=xx.xx.xx.xx.3 \
      --config obcluster.servers.global.home_path=/home/admin/oceanbase
    
    # Collect logs of the last 30 minutes with the information on different OBServer nodes varying.
    obdiag gather log --since 30m \
      --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
      --config obcluster.servers.nodes[0].ssh_username=test1 \
      --config obcluster.servers.nodes[0].ssh_password=****** \
      --config obcluster.servers.nodes[0].home_path=/home/test1/oceanbase \
      --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2
      --config obcluster.servers.nodes[1].ssh_username=test2 \
      --config obcluster.servers.nodes[1].ssh_password=****** \
      --config obcluster.servers.nodes[1].home_path=/home/test2/oceanbase
    
    # Collect logs of the last hour with the connection information of the `sys` tenant specified. In this case, obdiag automatically obtains the IP addresses of all nodes in the cluster.
    obdiag gather log --since 1h \
      --config db_host=xx.xx.xx.xx \
      --config db_port=xxxx \
      --config tenant_sys.user=root@sys \
      --config tenant_sys.password=*** \
      --config obcluster.servers.global.ssh_username=test \
      --config obcluster.servers.global.ssh_password=****** \
      --config obcluster.servers.global.home_path=/home/admin/oceanbase
    
  • Collect logs filtered by keyword

    # Collect logs of the last 30 minutes that are filtered by `TRACE_ID`.
    obdiag gather log --grep "TRACE_ID"  \
      --config db_host=xx.xx.xx.xx \
      --config db_port=xxxx \
      --config tenant_sys.user=root@sys \
      --config tenant_sys.password=*** \
      --config obcluster.servers.global.ssh_username=test \
      --config obcluster.servers.global.ssh_password=****** \
      --config obcluster.servers.global.home_path=/home/admin/oceanbase
    
    # Collect logs of the last 30 minutes that are filtered by multiple keywords, such as `AAAAA` and `BBBBB`.
    obdiag gather log --grep "AAAAA" --grep "BBBBB" \
      --config db_host=xx.xx.xx.xx \
      --config db_port=xxxx \
      --config tenant_sys.user=root@sys \
      --config tenant_sys.password=*** \
      --config obcluster.servers.global.ssh_username=test \
      --config obcluster.servers.global.ssh_password=****** \
      --config obcluster.servers.global.home_path=/home/admin/oceanbase
    
    # Collect logs of the specified period that are filtered by multiple keywords, such as `AAAAA` and `BBBBB`.
    obdiag gather log --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00" --grep "AAAAA" --grep "BBBBB" \
      --config db_host=xx.xx.xx.xx \
      --config db_port=xxxx \
      --config tenant_sys.user=root@sys \
      --config tenant_sys.password=*** \
      --config obcluster.servers.global.ssh_username=test \
      --config obcluster.servers.global.ssh_password=****** \
      --config obcluster.servers.global.home_path=/home/admin/oceanbase
    

    Notice

    If logs are filtered by multiple keywords, the keywords are evaluated by using the AND operator. In other words, only logs that meet all the specified keywords are collected.

Method 2: Use the command with a configuration file

Before you run the 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.

  • Collect logs of the specified period

    obdiag gather log --scope observer --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00" --grep STORAGE --encrypt true
    

    The output is as follows:

    ...
    ZipFileInfo:
    +-------------------+-----------+
    | Node              | LogSize   |
    +===================+===========+
    | xxx.xxx.xxx.xxx   | 36.184M   |
    +-------------------+-----------+
    ...
    
    ZipFileInfo:
    +-------------------+-----------+
    | Node              | LogSize   |
    +===================+===========+
    | xxx.xxx.xxx.xxx   | 44.176M   |
    +-------------------+-----------+
    ...
    
    Summary:
    +-------------------+-----------+----------+------------------+--------+-------------------------------------------------------------------------------+
    | Node              | Status    | Size     | Password         | Time   | PackPath                                                                      |
    +===================+===========+==========+==================+========+===============================================================================+
    | xxx.xxx.xxx.xxx   | Completed | 36.762M  | HYmVourcUyRNP8Om | 19 s   | obdiag_gather_pack_20220701183246/ob_log_xxx.xxx.xxx.xxx_20220701183247.zip   |
    +-------------------+-----------+----------+------------------+--------+-------------------------------------------------------------------------------+
    | xxx.xxx.xxx.xxx   | Completed | 638.200M | 1RicMaiLUUNfemnj | 718 s  | obdiag_gather_pack_20220701183246/ob_log_xxx.xxx.xxx.xxx_20220701183918.zip   |
    +-------------------+-----------+----------+------------------+--------+-------------------------------------------------------------------------------+
    
    

    Notice

    If encryption is enabled, collected logs are encrypted when being compressed. The value in the Password column indicates the password for decrypting the .zip package. Encryption is disabled by default.

  • Collect logs of a recent period

    # Collect logs of the last hour.
    obdiag gather log --since 1h
    
    # Collect logs of the last 30 minutes.
    obdiag gather log --since 30m
    
    # Collect logs of the last 30 minutes and specify the configuration file of the target cluster.
    obdiag gather log --since 30m -c /root/config.yml
    
  • Collect logs filtered by keyword

    # Collect logs of the last 30 minutes that are filtered by `TRACE_ID`.
    obdiag gather log --grep "TRACE_ID"
    
    # Collect logs of the last 30 minutes that are filtered by multiple keywords, such as `AAAAA` and `BBBBB`.
    obdiag gather log --grep "AAAAA" --grep "BBBBB"
    
    # Collect logs of the specified period that are filtered by multiple keywords, such as `AAAAA` and `BBBBB`.
    obdiag gather log --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00" --grep "AAAAA" --grep "BBBBB"
    

    Notice

    If logs are filtered by multiple keywords, the keywords are evaluated by using the AND operator. In other words, only logs that meet all the specified keywords are collected.

Results

The command generates a folder in the specified directory. A sample folder name is obdiag_gather_pack_20240808105846.

Previous topic

Inspection metrics
Last

Next topic

obdiag gather sysstat
Next
on this page
Syntax
Examples
Method 1: Use the command out-of-the-box without a configuration file
Method 2: Use the command with a configuration file
Results