Some of the most-used commands aren’t the big ones. They’re the little reflexes — how many rows did that import add?, show me the errors from the worker, not the health checks — that you reach for a dozen times a day. When those have friction, you feel it every time.
So this one’s for the muscle memory. The latest CLI ships two additions we’ve wanted ourselves: a one-off SQL flag, and real filtering on watasu logs.
Ask your database one question
watasu pg:psql has always dropped you into an interactive psql session. That’s the right tool when you’re exploring. But plenty of the time you don’t want a session — you have exactly one question, and you want the answer and your prompt back.
Now you can pass -c (or --command) and get just that:
watasu pg:psql --app my-app -c 'select count(*) from orders'
It runs the single statement, prints the result to stdout, and exits. No session to open, no \q to remember. Because it writes to stdout like any other command, it composes the way you’d hope:
# Drop it in a script, a cron job, or a quick health check
watasu pg:psql --app my-app -c 'select now()'
# Pipe it straight into whatever's next
watasu pg:psql --app my-app -c 'select email from users where banned' | sort > flagged.txt
Same database resolution rules as before — name the database, or let Watasu pick the one attached to your app. The interactive session is still one command away whenever you actually want to poke around.
Filter logs to the lines you meant
watasu logs already lets you narrow by process type, by instance, by line count, and stream with --tail. What it couldn’t do was filter on the content of the lines — so you’d pull a wall of output and pipe it through grep, losing the niceties of the stream along the way.
Now there’s -q (or --query), which understands a LogQL-style subset right inside the command:
# Show error lines, but not the health-check noise
watasu logs --app my-app -q '|= "error" != "healthcheck"'
# Worker failures and timeouts, live
watasu logs --app my-app -q '{process="worker"} |~ "failed|timeout"' --tail
The pieces, briefly:
- Selectors like
{process="web"}scope the stream before any text matching. |=and!=keep or drop lines containing an exact substring.|~and!~do the same with a regular expression — handy for|~ "timeout|refused|5\\d\\d".
Chain them together and the query reads top to bottom the way you’d say it out loud: this process, lines matching that, but not those. It applies to live streams too, so --tail -q '|= "error"' is now a perfectly good way to sit and watch only what matters.
Get started
Both land in the latest CLI — brew upgrade watasu (or grab it from the install docs) and you’re set. There’s nothing to enable; the flags are there the next time you run the commands.
Small tools, but they’re the kind you stop noticing — which is exactly the point. If a one-liner you wish existed is still missing, tell us at info@watasu.io. A surprising number of these start as someone’s offhand “could it just…”.
Happy querying — and may your logs be quiet.