This document defines how BinlogViz resolves binlog files when you use discovery mode.
Use discovery mode with both flags together:
binlogviz analyze --from-dir DIR --prefix PREFIXRequirements:
--from-dirsupplies the directory to scan.--prefixsupplies the filename prefix that matching files must start with.- Both flags are required together.
- Discovery mode cannot be combined with positional binlog file arguments.
If you already know the exact files you want, use positional file mode instead.
BinlogViz scans only the immediate entries under DIR and applies these rules to each entry:
- Directories are excluded.
- Symlinks are excluded.
- The filename must start with
PREFIX. - The suffix after
PREFIXmust be non-empty. - The suffix after
PREFIXmust contain digits only.
That means discovery accepts names such as:
mysql-bin.000123mysql-bin.000124
And excludes names such as:
mysql-bin.because the suffix is emptymysql-bin.indexbecause the suffix is not numericmysql-bin.000123.tmpbecause the suffix is not digits onlyrelay-bin.000123because the prefix does not match
The portion after the prefix is parsed as a base-10 integer.
For example, with --prefix mysql-bin.:
mysql-bin.9matches with suffix9mysql-bin.010matches with suffix010mysql-bin.000123matches with suffix000123
The numeric-only rule is what makes discovery suitable for ordered MySQL-style binlog sequences.
After matching, BinlogViz sorts the files before analysis.
Primary rule:
- Files are ordered by the parsed numeric suffix in ascending order.
This avoids lexical ordering mistakes such as placing mysql-bin.10 before mysql-bin.2.
Tie-break rule:
- If two matched filenames produce the same parsed numeric value, BinlogViz falls back to filename lexical order.
The resolved paths are then passed to the analysis pipeline in that final order.
When discovery succeeds, BinlogViz prints the ordered file list to stderr before parsing starts:
Resolved binlog files:
- /var/lib/mysql/mysql-bin.000123
- /var/lib/mysql/mysql-bin.000124
This helps operators verify exactly which files will be analyzed while keeping stdout available for text or JSON report output.
BinlogViz rejects these discovery-related input combinations:
You cannot combine positional files with discovery flags.
binlogviz analyze mysql-bin.000123 --from-dir /var/lib/mysql --prefix mysql-bin.This fails with:
cannot combine positional binlog files with --from-dir/--prefix
You cannot provide only one of the two discovery flags.
binlogviz analyze --from-dir /var/lib/mysql
binlogviz analyze --prefix mysql-bin.These fail with:
--from-dir and --prefix must be provided together
If the directory can be read but no entries satisfy the matching rules, the command fails.
Representative error:
no matching binlog files found under /var/lib/mysql with prefix "mysql-bin."
Use discovery mode when:
- the binlog files are stored together in one directory
- the sequence follows a stable numeric naming scheme
- you want BinlogViz to determine the ordered input list for you
Use positional file mode when:
- you need a hand-picked subset
- the files do not share one numeric-prefix contract
- you want shell expansion or explicit per-file control