Skip to content

Verify Chronicle events with the Cratis CLI

When a command appears to succeed but a read model has not changed, check the Cratis Chronicle event log first. The Cratis CLI can read the appended events directly, so you can separate what the command wrote from what an observer has processed into a read model.

Before checking, confirm the server, event store and namespace in your context. Use the same target throughout; a query against a different namespace cannot tell you what this command wrote.

The tail is the sequence number of the last appended event. Compare it before and after the action to see whether the log advanced:

Terminal window
cratis chronicle events tail --output plain

For a specific event source — say the account you just acted on:

Terminal window
cratis chronicle events tail --event-source-id "account-42"

A moving tail tells you that something was appended, but not whether it was the event you expected. List the events for the event source you acted on:

Terminal window
cratis chronicle events get --event-source-id "account-42"

Filter to the event type you expected, and get the full document as JSON to inspect its content:

Terminal window
cratis chronicle events get --event-source-id "account-42" --event-type AccountOpened --output json

Check the event type and content, not just whether the list has a row. If the expected event is absent, check your query’s target and filters, then investigate the command’s write path for a validation failure, constraint or unhandled case. If the event is present but the read model is wrong, follow Find and fix a stuck observer to inspect processing failures.

To inspect more than one event source, read a sequence range and export it:

Terminal window
cratis chronicle events get --from 0 --to 500 --output json > audit.json

The export covers sequence numbers 0 through 500; it does not include later events. Use --output plain when scanning rows in the terminal. Keep JSON when you need to inspect event content.

You have found the expected events and checked their content, or confirmed they are absent from the target and filters you checked. If the events are present and the projection definition has changed, replay the projection to rebuild its read model from history.