Review Glossary FR

Size

Eyes

Finish a part in any dojo to unlock the next eyes.

Day 29 10 min

jq basics

1 / 13 · ≈ 8 min left

The problem

The status endpoint of your cluster returns one long line of JSON. You want to know which service is down, and scrolling through the raw text does not tell you. jq reads JSON, runs a filter on it and prints the result as JSON again, or as plain text with -r.

The reps use services.json: {"region":"eu-west-1","services":[{"name":"api","status":"up","replicas":3},{"name":"worker","status":"down","replicas":0},{"name":"web","status":"up","replicas":2}]}. Pass the file name to jq as the last argument.