If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run this command to collect logs of OceanBase Database Proxy (ODP) on which the specified OceanBase cluster depends.
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 obproxy_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 ODP log to be collected. Valid values: obproxy, obproxy_digest, obproxy_stat, obproxy_slow, obproxy_limit, and all. |
| --grep | No | string | Empty | The search keyword. |
| --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.
NoteFor information about the parameters supported by this option, see Configure obdiag. |
Examples
Method 1: Use the command out-of-the-box without a configuration file
Collect logs of the specified period
obdiag gather obproxy_log --from "2022-06-25 10:25:00" --to "2022-06-25 18:30:00" \ --config obproxy.servers.nodes[0].ip=xx.xx.xx.1 \ --config obproxy.servers.nodes[1].ip=xx.xx.xx.xx.2 \ --config obproxy.servers.global.ssh_username=test \ --config obproxy.servers.global.ssh_password=****** \ --config obproxy.servers.global.home_path=/home/admin/obproxyThe output is as follows:
... ZipFileInfo: +------------------+-----------+ | Node | LogSize | +==================+===========+ | xxx.xxx.xxx.xxx | 36.184M | +------------------+-----------+ ... ZipFileInfo: +-------------------+-----------+ | Node | LogSize | +===================+===========+ | xxx.xxx.xxx.xxx | 44.176M | +-------------------+-----------+ ... Gather ObProxy Log Summary: +-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------------------+ | Node | Status | Size | Password | Time | PackPath | +===================+===========+==========+==================+========+====================================================================================+ | xxx.xxx.xxx.xxx | Completed | 36.762M | HYmVourcUyRNP8Om | 19 s | obdiag_gather_pack_20220701183246/obproxy_log_xxx.xxx.xxx.xxx_20220701183247.zip | +-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------------------+ | xxx.xxx.xxx.xxx | Completed | 638.200M | 1RicMaiLUUNfemnj | 718 s | obdiag_gather_pack_20220701183246/obproxy_log_xxx.xxx.xxx.xxx_20220701183918.zip | +-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------------------+Collect logs of a recent period
# Collect logs of the last hour with the target nodes accessible to obdiag without a password. obdiag gather obproxy_log --since 1h \ --config obproxy.servers.nodes[0].ip=xx.xx.xx.1 \ --config obproxy.servers.nodes[1].ip=xx.xx.xx.xx.2 \ --config obproxy.servers.nodes[2].ip=xx.xx.xx.xx.3 \ --config obproxy.servers.global.home_path=/home/admin/obproxy # Collect logs of the last 30 minutes with the target nodes accessible to obdiag without a password. obdiag gather obproxy_log --since 30m \ --config obproxy.servers.nodes[0].ip=xx.xx.xx.1 \ --config obproxy.servers.nodes[1].ip=xx.xx.xx.xx.2 \ --config obproxy.servers.nodes[2].ip=xx.xx.xx.xx.3 \ --config obproxy.servers.global.home_path=/home/admin/obproxy # Collect logs of the last 30 minutes with the information on different ODP nodes varying. obdiag gather obproxy_log --since 30m \ --config obproxy.servers.nodes[0].ip=xx.xx.xx.1 \ --config obproxy.servers.nodes[0].ssh_username=test1 \ --config obproxy.servers.nodes[0].ssh_password=****** \ --config obproxy.servers.nodes[0].home_path=/home/test1/obproxy \ --config obproxy.servers.nodes[1].ip=xx.xx.xx.xx.2 --config obproxy.servers.nodes[1].ssh_username=test2 \ --config obproxy.servers.nodes[1].ssh_password=****** \ --config obproxy.servers.nodes[1].home_path=/home/test2/obproxy
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.
obdiag gather obproxy_log --from "2022-06-25 10:25:00" --to "2022-06-25 18:30:00"
Results
The command generates a folder in the specified directory. A sample folder name is obdiag_gather_pack_20240808105846.