Since 0.0.78, audit-migrate validates retained archives and can create schema-2 copies with original-byte backups. Simulation is the default; the agent’s journal is never replaced automatically.
Preview, then convert
Stop all processes writing to this journal before conversion. Use the original retention settings and a new destination whose parent exists. This command needs no Docker connection.
monit-docker --audit-file /var/lib/monit-docker/events.jsonl \
--audit-max-bytes 5242880 --audit-files 5 \
audit-migrate --dry-run --output-dir /srv/monit-migration-001
monit-docker --audit-file /var/lib/monit-docker/events.jsonl \
--audit-max-bytes 5242880 --audit-files 5 \
audit-migrate --apply --output-dir /srv/monit-migration-001
Without --apply, the command validates and prints a JSON report without creating output files. The companion journal lock file may be created. A busy lock fails immediately. Global options precede audit-migrate.
Backup and output
| Created path | Contents |
|---|---|
backup/ | Byte-for-byte copies of the active file and retained archives. |
converted/ | Schema-2 files with the same names and event order. |
manifest.json | Final report: status, event counts, settings and SHA-256 checksums. |
Directories are private (0700), files are private (0600), and both belong to the invoking user. Existing destinations and reserved journal archive/lock paths are refused. Reserve space for both originals and converted copies; escaped text can grow.
Verification
Files are validated before creating the destination. Backups and outputs are reread to check full contents, schema, event counts, IDs and correlations. Additional scalar fields are preserved. There is no sorting or deduplication, and valid schema-2 values are not escaped again.
The report includes status (dry_run or complete), records, legacy_records, target_schema and a per-file inventory. The manifest has its own format version. Conversion is optional: normal reads already accept schemas 1 and 2.
Processing streams events without loading the entire history into memory. Each event must fit 64 KiB. Original and converted files must fit the configured full-read bound: --audit-max-bytes plus one maximum-size event. Increase the limit if escaping expands an archive beyond it, then use that setting when reading the converted files.
Errors and interruption
Exit codes: 0 for successful simulation or conversion, 2 for invalid arguments, 119 for migration failure. English diagnostics go to stderr; the JSON report goes to stdout.
Unknown schemas, invalid text, truncated/oversized events, nested fields, duplicate JSON keys and non-finite numbers are refused, as are symlinks and special files. A numbered archive outside --audit-files causes an error rather than being silently omitted.
After a write failure or interruption, originals remain intact and partial output is retained. Do not use a bundle without a final manifest.json containing status: "complete". A temporary file may remain. Also check exit status, fix the cause and retry with a new directory. There is no automatic resume, deletion or overwrite.
Activation and rollback
After verification, with writers still stopped, an operator can choose the new --audit-file path in converted/ or copy the converted set into a prepared persistent directory. Adjust ownership for the service user and retain the original limits. Check a full export before resuming writes.
Keep originals outside the rotation path. Do not concatenate the two sets: they contain the same IDs. Reload the first journal page after switching paths. For rollback, stop writes and preserve events added since activation separately before restoring a backup. Never replay their actions.
This command handles journals only, not configuration or persistent action state. See supported environments and the compatibility and backup procedure.

