History mode
The default behavior fetches recent log lines from disk and exits. No flag is needed. The CLI returns the last 100 lines unless you pass --lines. Useful for a quick spot-check after a deploy or a support call.
# Fetch the default 100 most-recent lines and exit
fieldwick logs --service <id>
# Fetch more history - up to 2 000 lines
fieldwick services logs <id> --lines 500
The two command forms above are equivalent - fieldwick logs --service is the short alias and fieldwick services logs is the long form. Both accept the same flags.
Live tail
Pass --tail to open a Server-Sent-Events stream that forwards every new log line to your terminal as it arrives. The stream stays open until you press Ctrl-C. There is no timeout - it will sit there all day if you leave it.
# Stream live output until Ctrl-C
fieldwick services logs <id> --tail
Live tail starts by replaying the last 100 lines so you have context, then switches to the real-time stream. If the service is restarting or scaling up you will see the new allocations join without re-running the command.
Filtering by text
The --filter flag does a case-insensitive substring match on every line before it reaches your terminal. It works in both history mode and live tail. Only lines that contain the filter string are shown - the rest are dropped silently.
# Show only lines that contain "error" (case-insensitive)
fieldwick services logs <id> --tail --filter error
# Combine with history mode for a quick grep over recent output
fieldwick services logs <id> --lines 500 --filter "payment"
For regex or multi-term matching, pipe the output into grep as usual - the CLI writes plain text to stdout in history mode.
JSON output for agents and scripts
Pass --json to emit one JSON object per line instead of plain text. Each object carries a timestamp, level, message, and service_id. Structured output makes it straightforward for an AI agent or monitoring script to parse log lines without building a text parser.
# Emit structured JSON lines - one object per log line
fieldwick services logs <id> --lines 500 --json
# Example output
{"timestamp":"2026-06-05T14:22:01Z","level":"error","message":"connection refused: db","service_id":"svc_abc123"}
{"timestamp":"2026-06-05T14:22:02Z","level":"info","message":"retrying in 5s","service_id":"svc_abc123"}
Combine --json with --filter to get structured error-only lines, or pipe into jq for on-the-fly reshaping.
Downloading a log file
To save logs to disk, redirect stdout to a file. In history mode the CLI exits cleanly after writing all lines, so the file is complete and safe to open.
# Save the last 500 lines as plain text
fieldwick services logs <id> --lines 500 > logs.txt
# Save as JSON for later analysis
fieldwick services logs <id> --lines 500 --json > logs.jsonl
The dashboard also provides a download button on the logs panel that exports the current view (up to 2 000 lines) as a .txt file without needing the CLI installed.