Skip to main content

Output Formats

Stave supports multiple output formats for different use cases.

JSON (Default for apply)​

stave apply --controls ./ctl --observations ./obs --format json

Structured output following the out.v0.1 schema. Machine-readable, suitable for piping to jq or ingestion by other tools. Results go to stdout; errors and logs go to stderr.

# Count violations
stave apply --controls ./ctl --observations ./obs | jq '.summary.violations'

# List violated resource IDs
stave apply --controls ./ctl --observations ./obs | jq -r '.findings[].resource_id'

# Get unique violated control IDs
stave apply --controls ./ctl --observations ./obs | jq -r '.findings[].control_id' | sort -u

Text​

stave apply --controls ./ctl --observations ./obs --format text

Human-readable output for terminal use. Includes color when the terminal supports it (respects NO_COLOR environment variable).

Quiet Mode​

stave apply --controls ./ctl --observations ./obs --quiet

Suppresses all output. Use the exit code to determine the result:

  • 0 = no violations
  • 3 = violations found

Writing Output to a Directory​

stave apply --controls ./ctl --observations ./obs --out ./results

Writes evaluation.json to the specified directory (created if it doesn't exist). Output is still printed to stdout as well.

Validation Output​

The validate command defaults to text output but supports JSON:

stave validate --controls ./ctl --observations ./obs --format json
{
"schema_version": "validate.v0.1",
"valid": true,
"errors": [],
"warnings": [],
"summary": {
"controls_checked": 10,
"snapshots_checked": 2,
"resource_observations_checked": 15,
"identity_observations_checked": 0,
"context_provided": false
}
}

Coverage Graph Output​

The graph coverage command outputs in DOT (default) or JSON format:

# DOT graph (pipe to graphviz)
stave graph coverage --controls ./ctl --observations ./obs | dot -Tpng > coverage.png

# JSON output
stave graph coverage --controls ./ctl --observations ./obs --format json | jq .

Downstream Artifacts​

Stave can generate enforcement artifacts from evaluation results:

CommandOutput
stave enforce --in eval.json --out ./dir --mode pabdir/enforcement/aws/pab.tf
stave enforce --in eval.json --out ./dir --mode scpdir/enforcement/aws/scp.json

Severity Mapping​

Stave severitySARIF levelCode Scanning display
criticalerrorError (red)
higherrorError (red)
mediumwarningWarning (yellow)
lownoteNote (blue)
infonoteNote (blue)

Exit Codes​

CodeMeaning
0Success (no violations, or command completed)
2Invalid input (bad flags, malformed files)
3Violations found (findings exceed threshold)
4Internal error
130Interrupted (SIGINT)

Exit 3 is a success — it means the tool found what it was looking for.

Logging​

Logs go to stderr and are separate from command output:

# Verbose logging
stave apply --controls ./ctl --observations ./obs -v

# Debug logging
stave apply --controls ./ctl --observations ./obs -vv

# JSON logs to file
stave apply --controls ./ctl --observations ./obs --log-format json --log-file run.log

# Include timestamps (breaks determinism)
stave apply --controls ./ctl --observations ./obs --log-timestamps