Skip to main content

Overview

If you have an existing audit log implementation (database tables, log files, or another service), you can migrate to Immutable incrementally without downtime.

Strategy

1

Map your schema

Map your existing audit log fields to Immutable’s event structure:
2

Dual-write in production

Start writing to both your existing system and Immutable simultaneously. This lets you validate that Immutable captures everything correctly before cutting over.
3

Backfill historical data

Use the batch endpoint to import historical events. Use idempotency_key to make the import safe to retry:
Use a unique idempotency_key per historical event (e.g. prefixed with migration_). This ensures safe replay — if the import job crashes partway through, you can re-run it without creating duplicate events.
4

Validate

Compare event counts and spot-check specific events between your old system and Immutable:
Check the pagination.total field in the response to compare against your old system’s count.
5

Cut over

Once you are confident in the data, remove the dual-write to your old system and use Immutable exclusively.

Gradual Rollout

If you prefer a more cautious approach, roll out by tenant:
  1. Start tracking events to Immutable for a single tenant.
  2. Verify the data is correct.
  3. Gradually add more tenants.
  4. Once all tenants are migrated, remove the old system.
Use the tenant_id field to isolate events per customer, making it easy to query and verify each tenant’s data independently.

Tips

  • Set occurred_at on backfilled events to preserve the original timestamp. Without it, all imported events will have the import time as their occurred_at.
  • The hash chain is built based on created_at (server time), so backfilled events will have a different chain order than their original chronological order. This is expected and correct.
  • Use event schemas in permissive mode during migration to discover all action strings your old system uses, then switch to strict mode once you have defined patterns for all of them.