Alert on error spikes

Build a threshold alert that pages your team on a real spike of errors, not on background noise, and verify signed webhooks.

Beginner10 min to complete2 min read

Before you start

  • A Tailcove source receiving logs
  • A Slack or Discord webhook URL, or an email address

A good alert fires when something is actually wrong and stays quiet otherwise. This guide builds an alert for a spike of errors, tuned against your real baseline.

On this page7 sections

1. Find your baseline#

Open the source's Logs tab and search for the lines you care about, over the last 24 hours:

level:error

Look at the volume chart. If you normally see a handful of errors per hour, a spike of 10 in five minutes is meaningful. If you see hundreds an hour, your threshold needs to be higher, or your query narrower:

level:error status>=500

Searching level:error over the last 24 hours: a couple of errors an hour, and one burst of 26 two hours ago

2. Create the alert#

Open the source's Alerts tab and create an alert:

Field Example Why
Name High 5xx rate Shown in every notification
Query level:error status>=500 Same language as search
Threshold count 10 Above your normal baseline
Window (minutes) 5 How far back to count
Cooldown (minutes) 30 Stops a flapping problem from paging repeatedly

Alerts are checked every minute. When the count reaches the threshold the alert triggers and notifies once; when it drops back below, it resolves and notifies again.

Creating the High 5xx rate alert: name, query, a 30-minute cooldown with the backtest, then Email as the channel

3. Choose channels#

Pick at least one:

  • Slack or Discord: paste an incoming webhook URL for the channel your on-call engineer watches.
  • Email: one or more addresses.
  • Webhook: your own endpoint, for automation.

4. Verify webhook signatures#

Webhook requests carry an X-Tailcove-Signature header: an HMAC-SHA256 of the raw body with your team's webhook signing secret. Always verify it before acting:

$signature = hash_hmac('sha256', $request->getContent(), $webhookSecret);

if (! hash_equals($signature, $request->header('X-Tailcove-Signature'))) {
    abort(401);
}

Compare with a constant-time function such as hash_equals, never ==. The payload's event field is alert.triggered or alert.resolved.

5. Test it#

Temporarily set the threshold to 1 and send a matching line:

curl -X POST https://ingest.tailcove.dev/api/v1/logs \
  -H "Authorization: Bearer YOUR_INGEST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message":"Test 500","level":"error","context":{"status":500}}'

Within about a minute the alert triggers and your channel receives a notification. Set the threshold back afterwards.

The alert page after twelve 502s arrive: Firing, with the firing in History and the email it sent

Tuning over time#

Review your alerts once a month. One that fires often with no action needed should get a higher threshold or a narrower query; one that never fires may be watching the wrong thing.

Next steps#

Ready to try it on your own logs?

The Free plan includes a source, live tail, search and alerts. No credit card.