---
title: "Error alerting with alert rules, email, and signed webhooks"
description: "Alerting tells you when an error needs a person. A LogBrew alert rule watches 1 project and sends an email and a signed webhook. Our first alert came 171 seconds after the error."
canonical: "https://logbrew.co/en/guides/alerts"
last_updated: "2026-11-25"
---

# Error alerting with alert rules, email, and signed webhooks

Alerting tells you when an error needs a person. A LogBrew alert rule watches 1 project and sends an email and a signed webhook. Our first alert came 171 seconds after the error.

Tested on November 25, 2026 with Node.js 22.18.0, @logbrew/node 0.1.30, @logbrew/sdk 0.1.48, curl 8.7.1, and logbrew CLI 0.1.96

By [Furkan Erday](https://github.com/furkanerday). Furkan Erday is the founder of LogBrew. He builds LogBrew with Claude Code and Codex every day.

Canonical: https://logbrew.co/en/guides/alerts

## What each error sent to the webhook

| What we sent | Alert sent | Signature valid |
| --- | --- | --- |
| First `PaymentDeclinedError` | New issue | Valid |
| Same error 2 more times | No alert | Nothing sent |
| 3 errors in 1 minute | Event count rule | Valid |
| No errors for 5 minutes | Missed heartbeat rule | Valid |
| Same error after Resolve | Regressed issue | Valid |
| Delivery with 1 added space | Same delivery | Rejected |

6 checks on 1 LogBrew project, with @logbrew/node 0.1.30 on Node.js 22.18.0 and 1 signed JSON webhook.

## Alert on new and returning errors

### Check the 2 rules every new project gets

A new project starts with 2 alert rules. 1 is for a new issue, and 1 is for a resolved issue that comes back. Both alert every project member. Read them with an API token that can read alert rules. Create the token in Settings, API Tokens. We cut each rule to 3 fields.

```bash
curl -s "https://api.logbrew.co/api/projects/<project_id>/alert-rules" \
  -H "Authorization: Bearer $LOGBREW_API_TOKEN"
```

Output

```text
{"rules": [
  {"kind": "new_issue", "recipients": {"project_members": true}, "muted": false},
  {"kind": "regression", "recipients": {"project_members": true}, "muted": false}
]}
```

### Send 1 error from your app

We threw a `PaymentDeclinedError` in a Node.js service and sent it with `@logbrew/node`. The client reads the server key from `LOGBREW_SERVER_API_KEY`. LogBrew puts each repeat of this error from the same file in 1 issue, so you get 1 alert, not 1 alert per event.

```bash
import { createIssueAttributesFromError } from "@logbrew/sdk";
import { createLogBrewNodeClient } from "@logbrew/node";
import { chargeOrder } from "./payments.mjs";

const logbrew = createLogBrewNodeClient({ sdkName: "checkout", sdkVersion: "1.0.0" });

try {
  chargeOrder();
} catch (error) {
  logbrew.issue(
    `evt_${Date.now()}`,
    new Date().toISOString(),
    createIssueAttributesFromError(error, {
      environment: "production",
      service: "checkout",
      fingerprint: "checkout-payment-declined"
    })
  );
}

await logbrew.shutdown();
```

### Read the alert

171 seconds after the error, our webhook got 2 deliveries. 1 was the `new_issue` event. The other was an `alert_rule` event from the new-issue rule. Each names the issue, the project, and the issue page. Project members also get the alert by email, unless they turned email off in Settings, Alerts.

Output

```text
{
  "id": "77d1db68-92e6-5603-9edd-ac9a4cc6bee2",
  "type": "new_issue",
  "occurred_at": "2026-11-25T10:59:32.827Z",
  "text": "New issue: PaymentDeclinedError (alerts-guide)",
  "url": "https://logbrew.co/en/dashboard/issues/990bbc25-4e45-5009-aa69-e8f7bb83f3e5",
  "project": {"id": "b908b1b0-07ad-5d42-bbf6-240415e44841", "name": "alerts-guide"},
  "issue": {"id": "990bbc25-4e45-5009-aa69-e8f7bb83f3e5", "title": "PaymentDeclinedError"},
  "rule": null,
  "usage": null
}
```

### Resolve the issue and send the error again

We resolved the issue with the CLI and ran the same code again. 178 seconds later, the webhook got a `regressed_issue` delivery and an `alert_rule` delivery from the regression rule.

```bash
logbrew resolve 990bbc25-4e45-5009-aa69-e8f7bb83f3e5
```

Output

```text
Issue 990bbc25-4e45-5009-aa69-e8f7bb83f3e5 marked resolved, priority medium, assignee unassigned trace=4d80667a255d9fa537c757cac9425c9f [unversioned / production].
```

## Alert on error spikes and silence

### Create an event count rule

An event count rule alerts when a window holds at least `threshold` events. This rule counts `error` events and above from the `checkout` service, 3 in 5 minutes. The token needs write access to alert rules.

```bash
curl -s -X POST "https://api.logbrew.co/api/projects/<project_id>/alert-rules" \
  -H "Authorization: Bearer $LOGBREW_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Checkout errors", "kind": "event_count", "level": "error",
       "service": "checkout", "threshold": 3, "window_minutes": 5,
       "recipients": {"project_members": true}}'
```

### Stay under the threshold

We sent the same error 2 more times in 1 minute. Nothing came. The issue was not new, and 2 events are fewer than 3.

### Cross the threshold

We sent 3 errors in 1 minute. The rule fired, and its `alert_rule` delivery came 156 seconds after the last error. The delivery names the rule and its kind.

Output

```text
{
  "id": "1bb84472-860a-51c2-b600-9c0197dca802",
  "type": "alert_rule",
  "occurred_at": "2026-11-25T10:52:00Z",
  "text": "Alert rule: Checkout errors: 3+ events in 5 min (alerts-guide)",
  "url": "https://logbrew.co/en/dashboard/issues?project=b908b1b0-07ad-5d42-bbf6-240415e44841",
  "project": {"id": "b908b1b0-07ad-5d42-bbf6-240415e44841", "name": "alerts-guide"},
  "rule": {"id": "20ef6d9b-e0aa-425f-beb9-9e5d8f6a1657", "kind": "event_count", "name": "Checkout errors"},
  "issue": null,
  "usage": null
}
```

### Alert when a service goes quiet

A missed heartbeat rule, `quiet_period` in the API, alerts when a service sends nothing for the whole window. Our `checkout` service sent nothing for 5 minutes, and the alert came 456 seconds after its last event.

```bash
curl -s -X POST "https://api.logbrew.co/api/projects/<project_id>/alert-rules" \
  -H "Authorization: Bearer $LOGBREW_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Checkout went quiet", "kind": "quiet_period",
       "service": "checkout", "window_minutes": 5,
       "recipients": {"project_members": true}}'
```

## Check the webhook signature

### Add a signed JSON webhook

The webhook URL must use `https` on port 443. The response shows `signing_secret` only once, so put it in your secret store.

```bash
curl -s -X POST "https://api.logbrew.co/api/projects/<project_id>/webhooks" \
  -H "Authorization: Bearer $LOGBREW_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Alerts receiver", "format": "generic",
       "url": "https://example.com/logbrew-webhook",
       "events": ["new_issue", "regressed_issue", "alert_rule"]}'
```

Output

```text
"format": "generic",
"events": ["new_issue", "regressed_issue", "alert_rule"],
"status": "active",
"signing_secret": "whsec_…"
```

### Verify each delivery

LogBrew signs each delivery with the Standard Webhooks scheme. The signature is the HMAC-SHA256 of the `webhook-id` header, the `webhook-timestamp` header, and the raw body, joined by dots. Check it on the raw body before you parse the JSON. Compare in constant time, and refuse a timestamp more than 5 minutes old.

```bash
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyLogBrewWebhook(secret, headers, body) {
  const id = headers["webhook-id"];
  const timestamp = headers["webhook-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const key = Buffer.from(secret.replace("whsec_", ""), "base64");
  const expected = createHmac("sha256", key)
    .update(`${id}.${timestamp}.${body}`)
    .digest("base64");
  return headers["webhook-signature"].split(" ").some((part) => {
    const [version, signature] = part.split(",");
    return (
      version === "v1" &&
      signature.length === expected.length &&
      timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
    );
  });
}
```

### Test it with a changed body

We checked each of the 8 deliveries of this test with the clock at its arrival time, and each passed. Then we added 1 space to each body, and each check failed.

Output

```text
2026-11-25 10:45:24 new_issue       original=true changed=false
2026-11-25 10:45:24 alert_rule      original=true changed=false
2026-11-25 10:54:24 alert_rule      original=true changed=false
2026-11-25 10:59:24 alert_rule      original=true changed=false
2026-11-25 11:02:24 alert_rule      original=true changed=false
2026-11-25 11:02:24 new_issue       original=true changed=false
2026-11-25 11:07:24 regressed_issue original=true changed=false
2026-11-25 11:07:24 alert_rule      original=true changed=false
8 deliveries: 8 valid, 8 changed bodies rejected
```

## What we saw when we tested it

We made 1 LogBrew project on the free tier and sent a `PaymentDeclinedError` from Node.js 22.18.0 with @logbrew/node 0.1.30. A signed JSON webhook took the `new_issue`, `regressed_issue`, and `alert_rule` events.

Each alert for an error reached the webhook 156 to 178 seconds after that error. LogBrew checks for alerts once a minute, so expect an alert in minutes, not seconds.

|  | Webhook event | Time after the error |
| --- | --- | --- |
| New issue | `new_issue` | 171 sec |
| New-issue rule | `alert_rule` | 171 sec |
| Event count rule | `alert_rule` | 156 sec |
| Missed heartbeat rule | `alert_rule` | 456 sec |
| Resolved issue came back | `regressed_issue` | 178 sec |

## Which alert rule to use

LogBrew has 5 kinds of alert rule. Each rule watches 1 project, in 1 environment or in all of them, and alerts all project members, chosen people, or teams. A project can have up to 100 rules.

Start with the 2 rules a new project already has. Add an event count rule for a flood of errors, and a missed heartbeat rule for a job or a service that must keep sending.

|  | Fires when | We tested it |
| --- | --- | --- |
| `new_issue` | An issue happens for the first time | Yes |
| `regression` | A resolved issue happens again | Yes |
| `escalation` | An issue reaches 5 times its usual rate | No |
| `event_count` | A window holds at least N events | Yes |
| `quiet_period` | A service sends nothing for the whole window | Yes |

## How LogBrew keeps alerts quiet

An alert that nobody acts on teaches people to ignore alerts. The Google SRE book says every page should be actionable. LogBrew groups events into issues, so the same error sent 3 times gave 1 alert, not 3.

Email comes as 1 digest every 15 minutes at most, and each email has a link that stops that kind of alert. A webhook delivery that fails is sent again after 1, 5, and 30 minutes, then after 2 and 6 hours. After 5 failed deliveries in a row, LogBrew turns the webhook off until you fix the endpoint. You can also mute or snooze a rule.

|  |  |
| --- | --- |
| Shortest gap between 2 alert emails | 15 min |
| Wait after failed attempt 1 | 1 min |
| Wait after failed attempt 2 | 5 min |
| Wait after failed attempt 3 | 30 min |
| Wait after failed attempt 4 | 2 hr |
| Wait after failed attempt 5 | 6 hr |
| Failed deliveries in a row that turn a webhook off | 5 |

## Questions people ask

### What is alerting?

Alerting sends a message to a person when your monitoring data needs action, such as a new error in production. In LogBrew, alert rules decide when to alert, and email or a webhook carries the alert.

### What is an alert rule?

An alert rule is a condition and a list of people. When the condition is true, such as 3 errors in 5 minutes, LogBrew alerts those people. LogBrew rules watch new issues, regressions, spikes, event counts, and missed heartbeats.

### How do I avoid alert fatigue?

Alert only on what needs action. Group repeated errors into 1 issue, send a digest, and set a threshold for noisy errors. In our test, the same error sent 3 times gave 1 alert, and 2 errors under a threshold of 3 gave none.

### How do I verify a webhook signature?

Compute the HMAC-SHA256 of the `webhook-id`, the `webhook-timestamp`, and the raw body, joined by dots, with the decoded secret. Compare it in constant time with each `v1` value in `webhook-signature`. A body with 1 added space failed this check.

### Do LogBrew alerts cost extra?

No. Alert rules, email alerts, and webhooks are on every LogBrew plan, the free tier too. We ran every test on this page on a free account.

## Get 1 alert for the next new error

LogBrew groups errors into issues and alerts you once per issue, by email and by signed webhook. Start on the generous free tier, no card needed.

[Start Free](https://logbrew.co/en)

## Sources

- [Standard Webhooks specification](https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md)
- [Node.js docs, Crypto](https://nodejs.org/api/crypto.html)
- [Google SRE book, Monitoring Distributed Systems](https://sre.google/sre-book/monitoring-distributed-systems/)
- [@logbrew/node on npm](https://www.npmjs.com/package/@logbrew/node)

## More guides for agents, Python, Node.js, and React

- [Claude Code MCP and Codex MCP server setup](https://logbrew.co/en/guides/mcp-server-claude-code-codex)
- [Use AGENTS.md in Claude Code and Codex](https://logbrew.co/en/guides/agents-md)
- [Fix the Claude overloaded error 529 and rate limit error 429](https://logbrew.co/en/guides/claude-overloaded-rate-limit-error)
- [Set up Python logging with the right log levels and exception capture](https://logbrew.co/en/guides/python-logging)
- [Structured logging with a log format and log levels you can search by field](https://logbrew.co/en/guides/structured-logging)
- [Set up the Pino logger or Winston in Node.js and keep every error](https://logbrew.co/en/guides/node-logging)
- [Set up Django logging and keep the traceback of every 500 error](https://logbrew.co/en/guides/django-logging)
- [Set up FastAPI logging and handle errors without losing the traceback](https://logbrew.co/en/guides/fastapi-logging)
- [Add a React error boundary and log the errors it misses](https://logbrew.co/en/guides/react-error-boundary)
- [Trace ID vs span ID, decoded from a real traceparent header](https://logbrew.co/en/guides/trace-id)
- [Interaction to Next Paint and TTFB, measured from real visits and fixed](https://logbrew.co/en/guides/web-vitals)
- [How to fix errors and set up logs, traces, metrics & releases](https://logbrew.co/en/guides)
