This article applies to the scenario of independent deployment of obdiag. Use the obdiag gather oms_log command to collect logs of OceanBase Migration Service (OMS) related components with one click.
If it is a cluster deployed by obd, information can be collected directly through the obd side diagnostic command group.
Description
Before use, you need to fill in the SSH login information of the OMS-related nodes in the obdiag configuration (that is, the configuration must include the IP, ssh_username, ssh_password, home_path, etc. of the OMS node). The OMS node configuration method is similar to obcluster/obproxy. For details, please refer to the deployment documentation or contact the administrator.
Instructions for use
obdiag gather oms_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, format: yyyy-mm-dd hh:mm:ss. |
| --to | No | string | Default is empty | The end time of log collection, format: yyyy-mm-dd hh:mm:ss. |
| --since | No | string | 30m |
The time range relative to the current time, format: <n><m|h|d>, where n represents the time number to be entered, m represents minutes, h represents hours, and d represents days, such as 1h represents the last hour. |
| --scope | no | string | all | Type of OMS logs to collect. Optional values are console, nginx, supervisord, drc, ghana, scheduler, web, alarm, api, gc, cm, supervisor, cdc, libobcdc, store, all. |
| --grep | No | string | Default is empty | Keyword filtering, can be specified multiple times, only collect log lines containing the specified keyword. |
| --store_dir | No | string | Current directory | Local path to store results. |
| --temp_dir | No | string | /tmp |
The temporary file storage directory on the remote OMS node. |
| --recent_count | No | int | 0 | Only collect the most recent N log files; --from, --to, --since are ignored when greater than 0. |
| --oms_component_id | No | string | Default is empty | The OMS component ID corresponding to the CDC log, in the format of 10.10.10.1-123. |
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag Self-configuration, format: --inner_config key=value. |
| --config | No | string | Default is empty | Cluster/OMS node configuration, format: --config key1=value1 --config key2=value2. See obdiag configuration for details. |
| --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. For details, see Configuration File Encryption. |
Prerequisites
- Obdiag has been installed and user-side configuration has been completed.
- The configuration already contains the SSH login information and log_path (OMS log root directory) of the OMS node, ensuring that the machine where obdiag is located can SSH to the OMS node.
Usage example
Method 1: Use with configuration file
After ensuring that the OMS node information has been configured in ~/.obdiag/config.yml, execute:
# Collect last 30 minutes of OMS logs (default)
obdiag gather oms_log
# Collect last 1 hour of OMS logs
obdiag gather oms_log --since 1h
# Specify time range
obdiag gather oms_log --from "2024-01-15 10:00:00" --to "2024-01-15 11:00:00"
# Collect only console and CDC logs
obdiag gather oms_log --scope console --scope cdc
# Keyword filter
obdiag gather oms_log --since 1h --grep "ERROR" --grep "Exception"
# Collect at most the 5 latest log files
obdiag gather oms_log --recent_count 5
# Specify CDC component ID (when collecting CDC logs)
obdiag gather oms_log --since 1h --oms_component_id 10.10.10.1-12345 --scope cdc
Method 2: Pass configuration through --config (out-of-the-box)
When passing OMS node information through --config, you need to specify the IP, ssh login information and log_path (OMS log root directory) of each OMS node, for example:
obdiag gather oms_log --since 1h \
--config oms.servers.nodes[0].ip=xx.xx.xx.1 \
--config oms.servers.nodes[1].ip=xx.xx.xx.2 \
--config oms.servers.global.ssh_username=admin \
--config oms.servers.global.ssh_password=****** \
--config oms.servers.global.log_path=/home/admin/logs
```<main id="notice" type='notice'>
<h4>Description</h4>
<p>OMS collection depends on <code>oms.servers</code> and <code>oms.servers.global.log_path</code> (OMS log root directory, required) in the configuration. CDC related logs also need to configure <code>store_path</code> and specify <code>--oms_component_id</code> in the command. For the configuration template, please refer to <code>~/.obdiag/example/all-components-with-oms.yml</code>. </p>
</main>
## Result description
After the command is successfully executed, a collection package (such as `obdiag_gather_pack_yyyyMMddHHmmss`) will be generated in the directory specified by `--store_dir`, which contains compressed log packages collected by each OMS node based on time and scope to facilitate troubleshooting of migration and synchronization issues.