This article applies to the scenario of independently deploying obdiag. Use the obdiag gather obproxy_log command to collect the logs of the ODP that the OceanBase cluster depends on with one click.
If it is a cluster deployed by obd, you can directly collect information on the selected cluster through the obd side diagnostic command group.
Instructions for use
obdiag gather obproxy_log [options]
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --from | No | string | Default is empty | The start time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --to | No | string | Default is empty | The end time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --since | No | string | 30m |
The most recent period of log collection, the format is: <n><m|h|d>, for example, 30m means the last 30 minutes. |
| --recent_count | No | int | 0 | Only collect the most recent N log files; --from, --to, --since are ignored when greater than 0. |
| --scope | No | string | all | Type of OBProxy logs to collect, configurable values are obproxy, obproxy_limit, obproxy_stat, obproxy_digest, obproxy_slow, obproxy_diagnosis, obproxy_error, all. |
| --grep | No | string | Default is empty | Select keywords for query. |
| --store_dir | No | string | Defaults to the current path where the command is executed | The local path where the results are stored. |
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag's own configuration. |
| --config | No | string | Default is empty | Configuration of the cluster to be diagnosed by obdiag, fixed style: --config key1=value1 --config key2=value2.
ExplanationThe parameters that support configuration through this option can be found in obdiag configuration. |
| --config_password | No | string | Default is empty | obdiag When using an encrypted configuration file, you need to pass in the corresponding password through this option.
ExplanationFor details, see Configuration file encryption. |
Usage example
Method 1: Use without configuration file (out of the box)
- Collect logs for a specified period of time
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.2 \
--config obproxy.servers.global.ssh_username=test \
--config obproxy.servers.global.ssh_password=****** \
--config obproxy.servers.global.home_path=/home/admin/obproxy
The 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 |
+-------------------+-----------+----------+------------------+--------+------------------------------------------------------------------------------------+
```* Quickly collect logs from the most recent period
```shell
# Passwordless SSH: collect last 1h of logs
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.2 \
--config obproxy.servers.nodes[2].ip=xx.xx.xx.3 \
--config obproxy.servers.global.home_path=/home/admin/obproxy
# Passwordless SSH: collect last 30m of logs
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.2 \
--config obproxy.servers.nodes[2].ip=xx.xx.xx.3 \
--config obproxy.servers.global.home_path=/home/admin/obproxy
# When OBProxy nodes differ: collect last 30m of logs
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.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 with configuration file
You need to ensure that the login information of the node to be collected has been configured in the obdiag configuration file config.yml. For related detailed configuration introduction, see obdiag configuration.
obdiag gather obproxy_log --from "2022-06-25 10:25:00" --to "2022-06-25 18:30:00"
Interpretation of results
After the command is executed, a folder will be generated in the specified directory. The folder is in the shape of: obdiag_gather_pack_20240808105846.
