Skip to content
CheckcraftDownload
Practical workflow

Log monitoring: how to get alerts about errors in logs

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. Download, no sign-up →

Log monitoring means you learn about an error in the log yourself and right away, not from a user a day later. One server needs just a script; several services need a central log store with alert rules. Below are options in order of complexity and what exactly to watch.

Checkcraft ·

Get help with your first test →

What to watch

Not all errors matter equally. Start with three signals: a sharp rise in ERROR count over a few minutes, new error messages never seen before, and critical events such as a payment decline or a database write failure. Review the rest in reports, not alerts.

How not to drown in alerts

Use thresholds over an interval, not every single error. Group identical messages. Every alert should say what to do: if the response is always nothing, turn it off. Otherwise in a week the team will ignore them all.

Diagram: one request goes through a gateway and services, all log records share one traceId

Monitoring and tests complement each other

Monitoring catches errors after users hit them. Log checks in autotests catch them before the release: the test sends a request, takes the traceId and confirms there is no ERROR in the log. Together they cover regression and unexpected failures.

Monitoring options

ScaleHowProsCons
One servertail and grep script, journalctl -fNothing to installNo history or grouping
Several servicesGrafana Loki alert rulesCheap storage, next to metricsCollection setup
Ready systemGraylogCollection, search, alerts in one boxA separate server
Logs in ElasticsearchKibana alert rulesUses what you haveSome connectors need paid Elastic tiers
API call diagram: method and URL, headers, body, status and response body, logs and database

Simplest single-file monitoring

#!/bin/sh
# простейший мониторинг одного файла: сообщение в лог системы при каждой новой ERROR
tail -n 0 -F /var/log/app/app.log | grep --line-buffered "ERROR" | while read -r line; do
  logger -t app-alert "$line"   # замените на отправку в мессенджер или почту
done

A Loki alert rule

# правило оповещения Grafana Loki: больше 20 ошибок payments за 5 минут
groups:
  - name: payments
    rules:
      - alert: PaymentsErrors
        expr: sum(count_over_time({service="payments"} |= "ERROR" [5m])) > 20
        for: 2m
        labels:
          severity: critical

A threshold over an interval and the for delay protect against alerts on a single error. Tune the threshold to the normal weekly error background.

Launch checklist

  1. Logs carry timestamp, level and traceId.
  2. 3–5 events you must know about immediately are defined.
  3. Each alert has a clear action and an owner.
  4. Noisy alerts are reviewed weekly.
  5. Key scenarios check logs in autotests before release.

The last item covers what monitoring cannot: finding the error before users do. See API regression testing.

More on logs

Section overview and all guides: Log file: what it is, where it is stored and how to read logs on Linux and Windows.

Frequently asked questions

How do I set up log monitoring?

A tail and grep script for one server; Loki, Graylog or Elasticsearch alert rules for several services.

Which log errors should I watch?

ERROR spikes, new error messages and critical events.

Monitoring vs log checks in tests?

Monitoring catches errors after release; test checks catch them before.

Next step

Repeat this on your own API

Checkcraft is a desktop app that saves API response checks without code and shows what did not match. Start with a sample, then use your own sanitized data. Free runs on Windows and Linux with no time limit.

Download FreeDownload and first run

No sign-up or email needed, the archive is ready in a couple of minutes. See the edition limits.

Start with the linked example and compare its result with your own test requirement.

Ask a person

Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

No account required. We will reply by email. This is a support request, not a newsletter subscription.