Real-time streaming of SHAR messages for monitoring and debugging workflows.

Usage

shar stream [flags]

Flags

  • -f, --filter <expression> - An expr expression to filter messages based on their fields

    • Field references use PascalCase (e.g., foo becomes Foo, foo.bar becomes Foo.Bar)
    • Example: WorkflowName == "OrderProcessing" && Status == "active"
  • -a, --ago <duration> - Specify how long ago to start streaming from (default: 30m)

    • Format: Go duration format (e.g., 1h, 30m, 1h30m)
  • -t, --type <types> - Specify which streams to listen on (comma-separated)

    • Valid values: state, api, system
    • Default: state

Examples

# Stream workflow state changes from the last 30 minutes
shar stream

# Stream state changes from the last hour
shar stream --ago 1h

# Stream with a filter for specific workflow
shar stream --filter 'WorkflowName == "OrderProcessing"'

# Stream multiple message types
shar stream --type state,api

# Stream from 2 hours ago with filter
shar stream --ago 2h --filter 'Status == "failed"'

Output

Streams messages in real-time, displaying:

  • Subject - The NATS subject the message was published to
  • Payload - The message payload (WorkflowState or other message types)
  • Vars - Workflow variables (for WorkflowState messages)
  • WorkflowStateTimestamp - Timestamp of the workflow state

Stream Types

state

Streams workflow state changes including:

  • Process transitions
  • Variable updates
  • Task completions
  • Error states

api

Streams API requests made to SHAR.

system

Streams system-level messages.

Filtering

The filter expression uses the expr language with automatic PascalCase conversion for field names. You can filter on any field in the message payload:

# Filter by workflow instance ID
shar stream --filter 'WorkflowInstanceId == "abc123"'

# Filter by multiple conditions
shar stream --filter 'WorkflowName == "OrderProcessing" && Vars.orderId > 1000'

# Filter by state
shar stream --filter 'State == "COMPLETED"'

Stopping the Stream

Press Ctrl+C (SIGINT) or send SIGTERM to gracefully stop streaming.