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.
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.

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
| Scale | How | Pros | Cons |
|---|---|---|---|
| One server | tail and grep script, journalctl -f | Nothing to install | No history or grouping |
| Several services | Grafana Loki alert rules | Cheap storage, next to metrics | Collection setup |
| Ready system | Graylog | Collection, search, alerts in one box | A separate server |
| Logs in Elasticsearch | Kibana alert rules | Uses what you have | Some connectors need paid Elastic tiers |

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" # замените на отправку в мессенджер или почту
doneA 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: criticalA 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
- Logs carry timestamp, level and traceId.
- 3–5 events you must know about immediately are defined.
- Each alert has a clear action and an owner.
- Noisy alerts are reviewed weekly.
- 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.
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 runNo 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.