CICD-358 · Structured log validation
Encyclopedia · Observability and SRE pipelines · All snippets
Previous · CICD-357 · Next · CICD-359
1. Where it fits
- Placement CI run step.
- Prerequisites staging metrics stack, provisioned endpoints and read-only CI identity except explicitly approved writes.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
jq -es 'length > 0 and all(.[]; (.level|IN("info","warn","error")) and (.message|type=="string"))' reports/app.jsonl3. How it works
The expression filters or transforms the input JSON. Where jq -e is used, a false or empty result can fail the gate.
4. Verify the result
Feed JSON lines from a fixture. Test invalid severity and missing messages to prove rejection.
Validation syntax-validated (Bash parse). Status definitions.