Use
--json for agent workflows. Keep credentials in protected local
configuration. Pass only variable names between people, tools, and agents.Set up with one command
Run this command in the directory of your app:LOGBREW_SERVER_API_KEY and adds the
init code. If setup cannot edit a file safely, it prints the code to add.
Setup shows each file change before it writes it, and asks you to confirm. It
does not replace values that are already in the env file. It changes only
files in the app directory. You can run it again. It keeps what is already set
up.
A coding agent or a script runs this command instead. It does the same steps
without questions and prints one JSON report:
--sample-data to load a sample issue, trace, logs, and actions into a
project that has no events. Sample data does not count toward your plan.
Verify your setup
Setup sends a test event with the project ingest key. LogBrew reads the event back before setup continues. Checkpoint: setup printsTest event: arrived in LogBrew. In the JSON
report, the verify step has status: "arrived", an event_id, and a
trace_id.
Read the test event yourself. Setup prints this command with your values:
LogBrew test event, in the environment test. To read it
from a CI job or an agent without account sign-in, use a project read key. See
Verify your setup.
If setup prints Test event: did not arrive, examine the key in the env file.
Then run setup again.
To do each step yourself, follow the steps below.
Before you start
Prepare:- Node.js 18 or newer.
- LogBrew CLI v0.1.30 or newer.
jq.- Bash or Zsh.
- A package directory for a server-side Node.js app.
quickstart-node, environment development, and
release quickstart@1. Keep this test separate from production. For another
runtime, use the SDK ingestion guide.
Send and read your first log
1
Read account status
Install the CLI with the command in the CLI guide. Then
read its account state.Checkpoint: status reports authenticated account access. If it does
not, a human runs
logbrew login once. Then run logbrew status --json
again. An agent must not start a new login when the current
authentication works.2
Create one project from the CLI
Select a new file in an owner-only directory. The CLI writes the project
ingest key to that file before it reports success. It never prints the key
or its file path.Project creation changes account state. The destination file must not
exist. If the result is not clear, run the exact command again. The CLI
reuses its pending request identity. Use
--abandon-retry only to start a
different attempt.Checkpoint: output reports status: "created", setup status
created, and an ingest-key kind. The project exists and the key is
stored. This does not show telemetry delivery. See
Projects.3
Install the Node.js SDK
4
Send one safe SDK log
Send release and environment markers with one placeholder-only Do not put credentials, headers, request bodies, customer data, or local
paths in the event.Checkpoint: the script prints
info log.
The key is set only for this Node.js process. Application identity goes
in context.Each run creates new event IDs. If the SDK retries delivery in the same
run, it sends the same body with the same IDs. LogBrew does not store an
accepted event a second time when a retry sends it again."ok":true with a 2xx
status_code. attempts is higher than 1 after a retry. A successful
send is not the last check.If delivery fails, the script exits with code 1 and prints a short JSON
error, such as {"ok":false,"error":"unauthenticated"}. It does not print
the request body or the key. A rejected project key causes
unauthenticated. A new CLI login does not fix it.5
Read the project doctor report
The CLI uses its saved account access for this read. Do not use the
project ingest key.Checkpoint: the report has
status: "ready". Also read each item in
checks. Exit code 0 does not show that all checks passed. For another
status, follow next and the
doctor report reference.
A ready project does not show that this test log arrived.6
Read the test log
Use the project, release, and environment from the SDK batch.Checkpoint:
LogBrew quickstart check appears for that project,
release, and environment. This shows delivery of the test log only.To run this read from a CI job or a coding agent without account sign-in,
use a project read key. See Verify your setup.Read the test result
The sample sends three events. Only one is a log. The release and environment markers give context to the log.
Keep the test at
info. Do not change it to error to make it easier to
find. Use the project and time filters instead. See
Severity values.
The console.log line prints the delivery result to your terminal. The
client.log call sends the log to LogBrew. A successful first delivery
prints:
--project
filter does not move events.
This log has no trace context because the sample does not create a request
span. That does not show that the log failed. The CLI read is a snapshot.
Run it again to read later events, or use logbrew watch logs --json for a
live stream.
Common recovery decisions
If telemetry is still missing, use the
first telemetry checks.
If those checks do not help, report a problem.
Do not attach credentials, raw telemetry, customer data, local paths, or
source code.
Move to your application
- Create the client once in your app’s setup code.
- Pin the SDK versions in your package files. Test upgrades outside production.
- Load the ingest key from your existing secret configuration. Rotate it after a possible exposure. See Rotate an ingest key.
- Use stable service, environment, and release names from your deployment configuration. See Releases.
- Write log messages that name the operation and its result, such as
Report generation completed. Keep private values out of the message. Do not copy a whole request or user record into a log. - Keep one sender for each application log to prevent duplicate records. Find the integration that already sends each record before you add LogBrew.
- Before a production rollout, send one safe event through the real code path and read it back. Check its message, service, release, and environment. A standalone sample does not test your application’s code path.
Projects
Read setup state and manage project ingest keys.
SDK ingestion
Select the SDK package for your runtime.
Investigate an issue
Follow trace and related-log evidence for one issue.
Report a problem
Send a safe, private support report.
