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:
versiondetermines which view to query, but does not detect the actual cluster version: For4.x, it queriesgv$ob_sql_audit; for3.x, it queriesgv$sql_audit. Fill in the view name that exists in the cluster; otherwise, an error indicating the view does not exist is reported.startTimeandendTimemust 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.endTimeis 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 bypollIntervalMillis. To collect historical data, setendTimeto a past point in time.databaseis required: If omitted, an error indicating the database could not be found is reported. Typically, set it tooceanbase.Choose either
usernameortenant: Ifusernameis already in theroot@tenantformat, addingtenantwill result in an invalid username and login rejection. To log in normally, userootasusernameand the tenant name astenant.targetTenantserves only as an identifier, does not participate in filtering conditions, and does not affect the collection results. To filter records by tenant, usewhereClause.
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
__MACOSXdirectory and pass the decompressed files (not directories) to-s.Wildcards should be expanded by the shell (write
-s ./logs/*.csvwithout quotes). The program itself does not perform globs matching.-sseparates 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
0if 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_SQLcan be used when only statement text is available: One input file counts as one session. ThesessionIdis taken from the input file name (without the extension). This is reflected in the logs assessionIdQuality=fallbackandsessionIdSource=fileBaseName. Timestamps increase sequentially based on the parsing time and do not represent the true source timing. Nouser,database, or source time is generated. Therefore, thesource_*columns in the report are 0, andsourceTypemust be specified using--source-type(default ismysql).The current version does not support multi-instance splitting for
--worker-countand--worker-index: Processes with different--worker-indexwill 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-sfile lists and independent-ooutput directories for each process. For multi-process splitting during playback, refer toreplay.replayerCountin Replay execution.
After parsing is complete, read from this directory using Replay execution.