On-demand workshop

Investigate a Production Error from Your Terminal

You install the monoscope CLI, log in, and follow one error from a service-level count to its trace, the events around it and the open issue behind it.

Before you start

  • A monoscope project that receives data. The Node.js workshop sets one up.
  • macOS or Linux, x86_64 or arm64
  • jq, for the steps that read JSON output

By the end you'll have

  • Installed and authenticated the monoscope CLI
  • Found the noisy service and its errors with facets and KQL searches
  • Read one error's full trace and the 5 minutes of events around it
  • Acknowledged the related issue and made a share link for your team

When a service starts failing, the first questions are always the same: which service, which requests, since when, and what else broke at the same time. The monoscope CLI answers each one with a single command, prints a table on your terminal and JSON when piped, so you can chain the answers without opening a browser. In this workshop you follow one error from a count to its root cause.

1. Install the CLI

The install script detects your platform, checks the SHA256 checksum and puts the binary in ~/.local/bin:

curl https://monoscopehq.com/install.sh | sh
monoscope --version

Re-run the same command later to upgrade. Details: Install.

2. Log In and Pick a Project

The browser login asks you to approve a device code, then saves a session token:

monoscope auth login
monoscope auth status

auth status shows which project the CLI uses. To change it, set the project UUID:

monoscope config set project <project-uuid>

For CI or any shell without a browser, use an API key from Settings → API Keys instead:

export MONOSCOPE_API_KEY=<api-key>
export MONOSCOPE_PROJECT=<project-uuid>
monoscope auth status

Details: Authenticate and environment variables.

3. Seed an Error to Follow

If your project already has errors, skip this step. Otherwise, send one error log so that every command below has something to find:

monoscope send-event -m "payment failed: card declined" \
  --level error --service checkout-api -t order:ord_8812

The seeded log gives logs search something to find, but it has no trace or HTTP status and may not open an issue. For steps 6 and 7, use a real error, such as the GET /orders/:id route from the Node.js workshop. In the steps below, replace checkout-api with the service you investigate.

4. Find the Service That Is Failing

Start with what exists, not with a guess. facets returns the precomputed top values of a field, which is faster than a summarize and tells you which values a filter will match:

monoscope services list
monoscope facets resource.service.name --top 5
monoscope facets attributes.http.response.status_code

If 500 shows in the status codes, it is worth a filter. If a field you expect is missing, search the schema:

monoscope schema --search http

Details: Discovery.

5. Search for the Errors

Searches take a positional KQL query. --service and --level are shorthands that add the service and severity filters:

# Error logs from one service in the last hour
monoscope logs search --service checkout-api --level error --since 1h

# Free text inside the log body
monoscope logs search 'body has "payment failed"' --since 1h

# HTTP 500s across every service
monoscope events search 'attributes.http.response.status_code == 500' --since 1h

KQL uses == and != for equality, not Lucene’s :. Always bound a search with --since or --from and --to.

To chain the next command, take the ID of the first match:

ID=$(monoscope logs search --service checkout-api --level error --since 1h --first --id-only)
monoscope events get "$ID"

Details: Logs, traces, events and the query language.

6. Read the Trace and the Window Around It

If the event has a trace ID, print every span of that trace. On a terminal, --tree draws a waterfall, one row per span:

monoscope traces get <trace-id> --tree

Then pull the 5 minutes around the error. --summary adds one row per trace with its services, span count and error count, which shows what else failed at the same time:

monoscope events context --window 5m --summary \
  --at "$(monoscope events get "$ID" | jq -r '.events[0].timestamp')"

To check the blast radius over time, chart the errors per minute:

monoscope metrics chart 'errors == true | summarize count() by bin(timestamp, 1m)' --since 2h

7. Check and Acknowledge the Issue

monoscope groups matching errors into one issue. List the open issues for the service, read one, and acknowledge it so your team knows someone is on it:

monoscope issues list --status open --service checkout-api \
  | jq '.data[] | {id, title, severity, service}'
monoscope issues get <issue-id>
monoscope issues ack <issue-id>

Every list command returns {data: [...], pagination: {...}}, so the same jq filters work for issues, monitors and log patterns.

Details: Issues, log patterns, monitors, dashboards.

8. Share the Evidence

Make a read-only link to the event for the incident channel or the bug ticket. Anyone can open it without an account for 48 hours:

monoscope share-link create \
  --event-id <event-id> \
  --created-at <event-timestamp> \
  --type log

The command returns {id, url}. To hand the whole investigation to Claude Code instead, install the monoscope skills and ask it to investigate the errors in checkout-api over the last hour. The investigate skill runs the same commands you ran here.

What You Built

You now have an authenticated CLI and a repeatable chain: discover with facets, search with KQL, read the trace and the window around it, then act on the issue. Each step consumes the previous step’s JSON, so the same chain runs in a shell script, a CI job or a coding agent.

Next Steps

Know what happened. Prove it.