Events
The events commands let you query events from an event sequence and retrieve the highest used sequence number. Use these commands to verify that events were appended, inspect their content, and understand the current state of an event log.
Retrieves events from an event sequence, with optional filtering by range, event source, and event type.
cratis chronicle events getOptions
Section titled “Options”| Flag | Description |
|---|---|
-e, --event-store <NAME> | Event store to query. Defaults to default. |
-n, --namespace <NAME> | Namespace to query. Defaults to Default. |
--sequence <NAME> | Event sequence to query. Defaults to the event log. |
--from <SEQUENCE_NUMBER> | Start of the sequence range (inclusive, 0-based). Defaults to 0. |
--to <SEQUENCE_NUMBER> | End of the sequence range (inclusive). Omit to read to the current tail. |
--event-source-id <ID> | Filter events to a single event source. |
--event-type <TYPES> | Comma-separated list of event type names or name+generation pairs to filter by. |
Output tip
Section titled “Output tip”Use --output plain when processing events in scripts. The plain format is approximately 25 times smaller than JSON because it omits embedded metadata, context headers, and schema details. Use --output json when you need the full event document including metadata.
Examples
Section titled “Examples”Get all events from the event log:
cratis chronicle events getGet events from sequence number 100 to 200:
cratis chronicle events get --from 100 --to 200Get all events for a specific event source:
cratis chronicle events get --event-source-id "user-42"Filter to a single event type:
cratis chronicle events get --event-type UserRegisteredFilter to a specific generation of an event type:
cratis chronicle events get --event-type UserRegistered+2Filter to multiple event types:
cratis chronicle events get --event-type UserRegistered,UserEmailChangedCombine filters for targeted inspection:
cratis chronicle events get --event-source-id "user-42" --event-type UserRegistered --output jsonGets the highest used sequence number in an event sequence. This is the tail of the log — the sequence number of the last appended event. It is not a count of events: gaps may exist in the sequence if events were redacted or sequences were not used contiguously.
cratis chronicle events tailOptions
Section titled “Options”| Flag | Description |
|---|---|
-e, --event-store <NAME> | Event store to query. Defaults to default. |
-n, --namespace <NAME> | Namespace to query. Defaults to Default. |
--sequence <NAME> | Event sequence to query. Defaults to the event log. |
--event-type <TYPE> | Return the tail sequence number for a specific event type. |
--event-source-id <ID> | Return the tail sequence number for a specific event source. |
Output
Section titled “Output”With --output plain, the command returns a single number on one line, making it easy to capture in a script:
TAIL=$(cratis chronicle events tail --output plain)Examples
Section titled “Examples”Get the tail sequence number of the event log:
cratis chronicle events tailGet the tail for a specific event source:
cratis chronicle events tail --event-source-id "user-42"Get the tail for a specific event type:
cratis chronicle events tail --event-type UserRegisteredCapture the tail number in a script:
TAIL=$(cratis chronicle events tail -e myapp --output plain)echo "Current tail: $TAIL"