obdiag gather clog/obdiag gather slog

2025-03-21 08:45:14  Updated

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run the obdiag gather clog command to call the ob_admin tool on the target node to parse clog files and collect clogs within the specified time range. You can also run the obdiag gather slog command to call the ob_admin tool on the target node to parse slog files and collect slogs within the specified time range.

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 clog

obdiag gather clog [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.
--store_dir No string The current path where the command is executed The local path where the results 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.

Note

For information about the parameters supported by this option, see Configure obdiag.

obdiag gather slog

obdiag gather slog [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.
--store_dir No string The current path where the command is executed The local path where the results 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.

Note

For information about the parameters supported by this option, see Configure obdiag.

Examples

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

  • Collect clogs.

    obdiag gather clog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00" \
        --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:

    Gather clog Summary:
    +-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
    | Node              | Status    | Size    | Time   | PackPath                                                              |
    +===================+===========+=========+========+=======================================================================+
    | xxx.xxx.xxx.xxx   | Completed | 15.762K | 6 s    | gather_pack_20230118002457/obadmin_xxx.xxx.xxx.xxx_20230118002458.zip |
    +-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
    
  • Collect slogs.

    obdiag gather slog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00" \
        --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:

    Gather slog Summary:
    +-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
    | Node              | Status    | Size    | Time   | PackPath                                                              |
    +===================+===========+=========+========+=======================================================================+
    | xxx.xxx.xxx.xxx   | Completed | 15.762K | 6 s    | gather_pack_20230118002457/obadmin_xxx.xxx.xxx.xxx_20230118002458.zip |
    +-------------------+-----------+---------+--------+-----------------------------------------------------------------------+
    
  • Collect slogs of nodes accessible to obdiag without a password.

    obdiag gather slog \
        --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.home_path=/home/admin/oceanbase
    
  • Collect slogs of nodes with different SSH logon passwords.

    obdiag gather slog \
        --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/test2/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 slogs of all nodes in a cluster 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 slog \
        --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.home_path=/home/admin/oceanbase
    

Method 2: Use the commands with a configuration file

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

    obdiag gather clog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00"
    
  • Collect slogs.

    obdiag gather slog --from "2023-01-16 18:25:00" --to "2023-01-17 01:30:00"
    

Contact Us