OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase AI DatabaseOceanBase Cloud OceanSeekOceanBase 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 DataPilotOceanBase OAgent

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase AI DatabaseOceanBase Cloud OceanSeekOceanBase 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 DataPilotOceanBase OAgent
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Migration Assessment

V5.0.0Enterprise Edition
  • What's New
  • Product Introduction
    • Overview
    • Application scenarios
  • Install OMA
  • Compatibility assessment
    • Overview
    • System architecture
    • Product form
    • Object and Metadata Assessment
    • Assess SQL statement compatibility
    • Sybase ASE assessment
    • Custom rules
    • Database assessment
      • Overview of Database Assessment
      • Assess an Oracle database
      • Assess a MySQL database
      • Assess a TiDB database
      • Assess a PostgreSQL database
    • SQL execution verification
    • Mapper Scan Audit
    • Special Identification and Declaration Association
  • Performance assessment
    • Standalone edition
      • Overview
      • System architecture
      • Product form
      • Assess the performance difference between an Oracle database and an OceanBase database
      • Assess the performance differences between a MySQL database and an OceanBase database
      • Assess the performance differences between different versions of OceanBase Database
      • Log parsing
      • Replay execution
      • Performance statistics and reports
  • Release Notes
    • OMA V5.0.0

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Migration Assessment
  3. V5.0.0

Log parsing

Last Updated:2026-11-27 06:14:19

Syntax
Parameters
Output structure
Examples
Direct connection to the source for collection
Input preparation

oma analyze converts source audit logs, slow logs, or general logs into a unified CANONICAL_JSONL event stream for reading during the replay phase. The parsing phase does not connect to the source or target database.

Syntax

java -Xmx2g -jar oma.jar analyze \
  -f <log_format> -s <input_file_path> -o <output_directory> \
  --shards <number_of_shards> --max-threads <number_of_threads>

You can run java -Xmx2g -jar oma.jar analyze --help for a complete list of options.

Parameters

Parameter
Default Value
Description
-f, --format None Log format. For more information, see Performance assessment overview.
-s, --source None Enter the file paths, separating multiple files with commas. Directories will not be expanded; a directory passed in will be read as individual files.
-o, --output None CANONICAL_JSONL output directory. A new directory is used for each parsing task.
-c, --config None Path to the YAML or JSON configuration file. The fields correspond to command-line options.
--plugins-dir ./plugins External plugin directory. Plugins must be obtained separately and placed in this directory. The main JAR does not include built-in plugins. When parsing plugin formats, specify the actual directory using this option.
--source-type mysql Source Database Type, Written Event FieldsourceType
--source-instance unknown Source instance ID, written in the event field.sourceInstance
-tz, --timezone Asia/Shanghai Timezone for Timestamp Parsing
--shards 10 Number of Output Sharded Directories
--shard-strategy session Sharding Routing Strategy:sessionMerged by session. A single session is not split across multiple shards, and shard sizes may vary;round_robinEvent-based rotation with even shard sizes, but the same session may be split
--max-threads 4 Number of Parsing and Major Compaction Threads
--max-file-size 256 Maximum size of a single output file, in MB
--sort-batch-size 100000 The batch size for in-memory sorting before writing to a shard. Increasing this value increases heap usage.
--temp-dir None Intermediate Files Directory
--worker-count 1 Total number of shards across multiple instances. Multi-instance splitting is not supported in the current version. For more information, see "Input preparation".
--worker-index 0 The shard number of the current worker. Value range:0toworker-count - 1. Multi-instance splitting is not supported in the current version.
-h, --help、-V, --version None View Help and Version

The configuration file fields are format, sourceType, sourceInstance, timezone, inputPaths, outputDir, and options. For formats that require connecting to the source or controlling the collection window, place the specific parameters under options. For example, OCEANBASE_SQL_AUDIT reads from options.sqlAudit. Missing this key will result in the error options.sqlAudit is required for OCEANBASE_SQL_AUDIT format.

Output structure

The output directory is organized by shard, with each shard containing volume-specific JSONL files:

<output_directory>/shard_1/traffic-<timestamp>-part-000001.jsonl

Each line represents an event, with the following fields:

format, version, sourceType, sourceInstance, sessionId, sequence, timestamp, eventType, user, database, sqlText, sqlType, sqlId, costTimeMicros, and attributes.

Here, format is fixed as OB_REPLAY_CANONICAL, and version is 1. eventType can be values such as QUERY, SET_VARIABLE, or USE_DATABASE, representing session actions. costTimeMicros records the source-side execution time in microseconds. For formats where the source did not record time, this field is 0; for PLAIN_SQL, it is -1. attributes carries information specific to each source. Among them, sessionIdQuality and sessionIdSource record the origin of the session ID (source or connectionId for direct connection collection; falls back to the filename if no session information is available). In formats that provide only statement text, user and database are missing by default. If the source explicitly set these to null, database is the string null instead of a null value. During replay, this field is used as the database name for connection, as described in Replay execution under "Which database will the session connect to?". In replay configuration, fill in CANONICAL_JSONL for s3.logFormat.

The unit of the source-side execution time column is assumed by the parser and may not match the column definition in the source log: the latency column in RDS_SLS is converted from seconds to microseconds. If the source column is not in seconds, the reported source_* percentile values are multiplied by the conversion factor. When unsure, first calibrate with a statement whose time is known, then compare with target_*.

Examples

Parse Alibaba Cloud RDS audit logs:

java -Xmx2g -jar oma.jar analyze \
  -f RDS_SLS -s ./logs/rds-small.csv.gz \
  -o ./work/rds-canonical --shards 1 --max-threads 1

Parse PolarDB logs:

java -Xmx2g -jar oma.jar analyze \
  -f POLARDB -s ./logs/polardb/xxxx.csv \
  -o ./work/polar-canonical --shards 1 --max-threads 1

Plugin registration formats are not recognized when the plugin is not loaded. At runtime, an error indicating unsupported format is reported (exit code 1) along with a list of currently supported formats. The program supports multiple built-in log formats, and plugins provide additional formats. When parsing plugin formats like TiDB General Log, specify the plugin directory:

java -Xmx2g -jar oma.jar analyze \
  -f TIDB_GENERAL_LOG -s ./logs/tidb-general.log \
  -o ./work/tidb-canonical --plugins-dir ./plugins

Direct connection to the source for collection

OCEANBASE_SQL_AUDIT does not read files; instead, it connects to the source OceanBase database and polls SQL audit views. The parameters are defined under options.sqlAudit in the configuration file. The fields include host, port, username, password, tenant, database, tenantMode, version, startTime, endTime, pollIntervalMillis, batchSize, whereClause, connectRetry, queryTimeoutSeconds, and targetTenant. Note that tenantMode must be set to the lowercase value mysql or oracle. The default values for batchSize and pollIntervalMillis are 5000 and 10000, respectively.

Parameter considerations:

  • version determines which view to query, but does not detect the actual cluster version: For 4.x, it queries gv$ob_sql_audit; for 3.x, it queries gv$sql_audit. Fill in the view name that exists in the cluster; otherwise, an error indicating the view does not exist is reported.

  • startTime and endTime must be ISO offset times with a time zone (for example, 2026-11-12T17:00:00+08:00). An invalid format will cause a parsing error.

  • endTime is a polling watermark, not a deadline: Set it to a future time, and the process will continuously poll until that moment at the interval specified by pollIntervalMillis. To collect historical data, set endTime to a past point in time.

  • database is required: If omitted, an error indicating the database could not be found is reported. Typically, set it to oceanbase.

  • Choose either username or tenant: If username is already in the root@tenant format, adding tenant will result in an invalid username and login rejection. To log in normally, use root as username and the tenant name as tenant.

  • targetTenant serves only as an identifier, does not participate in filtering conditions, and does not affect the collection results. To filter records by tenant, use whereClause.

The collection output format is CANONICAL_JSONL, similar to other formats. The sessionId is in the format ob-<sourceInstance>-<connection ID>, and costTimeMicros represents the actual microseconds consumed in the view.

Collection statements themselves are also collected: The statements used by the collector to poll the gv$sql_audit view are recorded and can interfere with timing statistics during playback. Use whereClause to exclude statements from the collection account itself, or filter them by sqlId before playback.

Input preparation

  • Files compressed with gzip can be read directly without manual decompression. For ZIP files, decompress them into separate directories to avoid overwriting files with the same name. Ignore the __MACOSX directory and pass the decompressed files (not directories) to -s.

  • Wildcards should be expanded by the shell (write -s ./logs/*.csv without quotes). The program itself does not perform globs matching.

  • -s separates multiple inputs with commas. Therefore, if a filename contains commas, rename it first to prevent it from being parsed as multiple paths.

  • The exit code is still 0 if the input path is invalid, a directory is passed, or all file parsing fails. Only a WARN message like "Parsing failed summary: N inputs skipped" is logged. After each parsing completion, verify the number of output events; do not rely solely on whether the command returns successfully.

  • The number of original records and the number of output events may differ due to empty SQL statements, filtering conditions, and non-query records.

  • PLAIN_SQL can be used when only statement text is available: One input file counts as one session. The sessionId is taken from the input file name (without the extension). This is reflected in the logs as sessionIdQuality=fallback and sessionIdSource=fileBaseName. Timestamps increase sequentially based on the parsing time and do not represent the true source timing. No user, database, or source time is generated. Therefore, the source_* columns in the report are 0, and sourceType must be specified using --source-type (default is mysql).

  • The current version does not support multi-instance splitting for --worker-count and --worker-index: Processes with different --worker-index will parse all inputs and write all shards. Multiple processes writing to the same output directory will result in duplicate data. For horizontal scaling, specify non-overlapping -s file lists and independent -o output directories for each process. For multi-process splitting during playback, refer to replay.replayerCount in Replay execution.

After parsing is complete, read from this directory using Replay execution.

Previous topic

Assess the performance differences between different versions of OceanBase Database
Last

Next topic

Replay execution
Next
on this page
Syntax
Parameters
Output structure
Examples
Direct connection to the source for collection
Input preparation