# Monitor server errors

- Check 05.14 · HTTP and redirects · Critical
- Source: https://checklist-seo-geo.com/en/http-redirects/monitor-server-errors
- Monitor 5xx errors: error rate from the logs, alerts, exception tracking, CloudWatch, Cloudflare, WordPress, Laravel and a Search Console review.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/http-redirects/monitor-server-errors.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

Monitoring server errors means knowing within minutes that part of the site is returning 5xx errors, and on which URLs, before crawlers, customers or Search Console reveal it. An uptime probe is not enough: it tests a few pages, whereas errors often affect a specific template or feature. This task sets up four levels: an error rate calculated from the logs, application exception tracking, alerts on hosting or CDN metrics, and a weekly review of what Google and Bing see.

## Why it matters

Google slows down its crawling in proportion to the number of URLs that return a server error, then removes from the index those whose error persists. The exact timeframe is not published, but an error that lasts several days on a template costs indexed pages. Search Console's Page indexing report, for its part, updates several days late: it is a check, not an alert.

The most costly errors are often invisible during normal browsing:

- **Intermittent**: 3% of 504s at peak times, which nobody reproduces during the day.
- **Localized**: a category filter, a search page, a product page with a particular variant.
- **Crawler-only**: deep pages that are never cached, crawled mostly by Googlebot, Bingbot and generative engine crawlers.
- **Silent**: an error page served with a 200 code, which escapes every metric.

This task complements two others: uptime monitoring (is the site responding?) in [monitor uptime and alerts](https://checklist-seo-geo.com/en/security-infrastructure/monitor-uptime-alerts), and monitoring of DNS and connectivity as seen by crawlers in [monitor DNS and server errors](https://checklist-seo-geo.com/en/crawling/monitor-dns-server-errors).

## What it improves

- **Time to detection**: a few minutes instead of several days.
- **Indexing**: errors are fixed before URLs drop out of the index.
- **Diagnosis**: each alert arrives with the URLs, the time and the exception, which shortens the fix.
- **Conversions**: errors in the checkout flow or in forms are spotted the same day.
- **Availability for AI assistants**: fewer failed retrievals. An indirect effect, with no guarantee of citations.

## How to check

Take stock of what exists, then trigger an error to test the alert chain:

1. **Logs**: does the format include the HTTP status code and the response time? Are they kept for at least 30 days?
2. **Alerts**: who receives what, through which channel? Does an alert arrive if 5% of requests fail for 10 minutes?
3. **Application**: are exceptions collected somewhere other than a file nobody reads?
4. **Search engines**: does someone open the [Page indexing report](https://search.google.com/search-console/index) and the [Crawl stats](https://search.google.com/search-console/settings/crawl-stats) every week?

End-to-end test, on a route set up for this purpose or on staging:

```bash
for i in $(seq 1 50); do curl -s -o /dev/null https://staging.example.com/test-erreur-500; done
```

Compliant: an alert arrives within the expected time, with the URL at fault.

## How to implement

### Before you start

Define the signals, thresholds and recipients before choosing the tools. The thresholds below are common starting points, to be adjusted to your traffic:

| Signal | Source | Starting alert threshold | Frequency |
|---|---|---|---|
| 5xx rate across all requests | Logs, CDN, load balancer | more than 1 to 2% for 5 to 10 min | Continuous |
| 5xx received by verified crawlers | Logs | more than 10 per hour | Hourly |
| New application exception | Error tracking | any new error | Continuous |
| Response time | Logs (`$request_time`), APM | 95th percentile above 2 s | Continuous |
| URLs under “Server error (5xx)” | Search Console | any increase | Weekly |
| Crawling down | Crawl stats | clear drop with no change to the site | Weekly |

Two rules:

- **One alert = one owner and one action.** Name a recipient and a backup. See [assign an owner to each issue](https://checklist-seo-geo.com/en/automation-quality-control/assign-owner-each-issue).
- **No alert on an isolated error.** A threshold that is too low produces noise and ends up ignored.

Record every incident (start, end, cause, URLs affected) in the [incident log](https://checklist-seo-geo.com/en/automation-quality-control/keep-incident-log): that is what explains a drop in crawling three weeks later.

### Free monitoring script

On the server, this script calculates the 5xx rate over the last 5,000 requests and sends the list of URLs in error if the threshold is exceeded. File `/usr/local/bin/taux-5xx.sh`:

```bash
#!/usr/bin/env bash
JOURNAL="/var/log/nginx/access.log"
LIGNES=5000
SEUIL=2
DESTINATAIRE="admin@example.com"

read -r total erreurs < <(tail -n "$LIGNES" "$JOURNAL" | awk '{t++} $9 ~ /^5/ {e++} END {print t + 0, e + 0}')
taux=$(awk -v e="$erreurs" -v t="$total" 'BEGIN {printf "%.1f", (t > 0 ? 100 * e / t : 0)}')

if awk -v x="$taux" -v s="$SEUIL" 'BEGIN {exit !(x > s)}'; then
  {
    echo "5xx rate: $taux% ($erreurs of $total requests)"
    echo
    tail -n "$LIGNES" "$JOURNAL" | awk '$9 ~ /^5/ {print $9, $7}' | sort | uniq -c | sort -rn | head -20
  } | mail -s "5xx alert example.com: $taux%" "$DESTINATAIRE"
fi
```

Schedule it every five minutes (`crontab -e`):

```txt
*/5 * * * * /usr/local/bin/taux-5xx.sh
```

Adjust `LIGNES` to cover about ten minutes of traffic. The `mail` command assumes a configured mail transfer agent; otherwise, send the text to your team chat's webhook with `curl`. This script complements an external probe: if it goes down with the server, it alerts nobody.

For a weekly view, GoAccess produces an HTML report with the breakdown of status codes and the URLs in error:

```bash
goaccess /var/log/nginx/access.log --log-format=COMBINED -o /var/www/rapports/acces.html
```

Protect this report with authentication: it contains IP addresses.

### Nginx

Versions: Nginx 1.18 and later.

Add the response times and the upstream service address to the log format, to tell a slow server from a failed one. In the `http` context:

```nginx
log_format surveillance '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent '
                        '"$http_referer" "$http_user_agent" $request_time $upstream_response_time $upstream_addr';
access_log /var/log/nginx/access.log surveillance;
```

The fields of the standard format stay first: the script above still works. Reload with `sudo nginx -t && sudo systemctl reload nginx`. Keep the logs for at least 30 days in `/etc/logrotate.d/nginx` (`rotate 30` with daily rotation).

### Apache

Versions: Apache 2.4.

Add the processing time (`%D`, in microseconds) to the combined format, in the server configuration:

```apache
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" surveillance
CustomLog ${APACHE_LOG_DIR}/access.log surveillance
```

Also monitor the error log: messages about `MaxRequestWorkers` and fatal PHP errors herald 503s and 500s. Reload with `sudo apachectl configtest && sudo systemctl reload apache2`.

### Cloudflare

Versions: Cloudflare dashboard, Free to Enterprise plans, November 2026.

- **Traffic analytics**: the zone dashboard lets you filter responses by HTTP status code. A spike in 52x points to the connection with the origin, a spike in 500s to the application.
- **Notifications**: on the account's Notifications page, the “Health Checks status” alert (Pro plans and above) warns you when a health check fails; first create the health check on a dynamic page and on `/robots.txt`. The origin error rate alert is reserved for the Enterprise plan.
- **Free plan**: no alert on the 5xx rate. Rely on the origin logs and an external probe.

If Cloudflare's protection serves challenge pages, they do not appear in your origin logs: also monitor the Events tab in [`Security > Analytics`](https://dash.cloudflare.com/?to=/:account/:zone/security/analytics).

### AWS

Versions: Amazon CloudWatch, Elastic Load Balancing (ALB) and CloudFront, AWS CLI v2, November 2026.

A CloudWatch alarm on an Application Load Balancer's target errors, linked to an SNS topic that sends an email or feeds your team chat:

```bash
aws cloudwatch put-metric-alarm \
  --alarm-name example-com-5xx-cibles \
  --namespace AWS/ApplicationELB --metric-name HTTPCode_Target_5XX_Count \
  --dimensions Name=LoadBalancer,Value=app/NOM_DU_REPARTITEUR/IDENTIFIANT \
  --statistic Sum --period 300 --evaluation-periods 2 \
  --threshold 50 --comparison-operator GreaterThanThreshold \
  --treat-missing-data notBreaching \
  --alarm-actions arn:aws:sns:eu-west-3:123456789012:alertes
```

Add the same alarm on `HTTPCode_ELB_5XX_Count` (errors from the load balancer itself). For **CloudFront**, the distribution's `5xxErrorRate` metric is published in the `us-east-1` region. For application logs sent to CloudWatch Logs, a metric filter on the word `ERROR` gives an equivalent alarm.

### Plesk

Versions: Plesk Obsidian 18.0.

The domain's logs are in `Websites & Domains > your domain > Logs`, filterable by type, and on disk in `/var/www/vhosts/system/example.com/logs/`. The free script works by pointing `JOURNAL` to `access_ssl_log`. Schedule it in `Tools & Settings > Scheduled Tasks`, or in the domain's scheduled tasks.

### cPanel

Versions: cPanel & WHM 110 and later, Jupiter theme.

`Metrics > Errors` displays the latest errors, `Metrics > Raw Access` lets you download the access logs, and `Advanced > Cron Jobs` lets you schedule the script if it has access to your account's logs. Otherwise, use an external probe and the application's error tracking.

### Shared hosting

Without real-time access to the logs, combine three sources: a free external probe (UptimeRobot, or Uptime Kuma self-hosted elsewhere) on the homepage, a dynamic page and `/robots.txt`; the CMS error log; the weekly Search Console review. Raw access logs, when the host provides them, can be downloaded for a one-off analysis.

### WordPress

Versions: WordPress 5.2 and later (up to 7.1).

- **PHP error log**: `WP_DEBUG_LOG` writes to `wp-content/debug.log` (with `WP_DEBUG_DISPLAY` set to `false`). Monitor its size and content, and protect it from public access, or set a path outside the web root by giving `WP_DEBUG_LOG` a file path.
- **Fatal errors**: WordPress sends a recovery mode email to the admin address. To send it to the technical team, set another address in `wp-config.php`:

```php
define( 'RECOVERY_MODE_EMAIL', 'technique@example.com' );
```

- **Error tracking**: Sentry and equivalent services offer PHP and JavaScript integrations for WordPress, through a plugin or through configuration.
- **One-off diagnosis**: Query Monitor displays a page's PHP errors and slow queries for logged-in administrators.

### Laravel

Versions: Laravel 10 to 13.

Send errors to an alert channel in addition to the file. In `config/logging.php`, add a channel:

```php
'alertes' => [
    'driver' => 'slack',
    'url' => env('LOG_SLACK_WEBHOOK_URL'),
    'username' => 'example.com alerts',
    'level' => 'error',
    'replace_placeholders' => true,
],
```

Unhandled exceptions are logged at the `error` level and therefore go to the channel. To group identical errors and avoid bursts of messages, prefer an error tracking service. With Sentry:

```bash
composer require sentry/sentry-laravel
php artisan sentry:publish --dsn=VOTRE_DSN
```

Laravel Pulse, free and self-hosted, also displays exceptions and slow queries in a dashboard. Enabling the channel and Sentry then depends on the version.

#### Laravel 11 to 13

In `.env`:

```ini
LOG_CHANNEL=stack
LOG_STACK=daily,alertes
LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/VOTRE/WEBHOOK
```

Then, in `bootstrap/app.php`:

```php
use Sentry\Laravel\Integration;

->withExceptions(function (Exceptions $exceptions): void {
    Integration::handles($exceptions);
})
```

#### Laravel 10

The `LOG_STACK` variable does not exist: in `config/logging.php`, list the channels of the `stack` channel (`'channels' => ['daily', 'alertes']`), then, in `.env`:

```ini
LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/VOTRE/WEBHOOK
```

For Sentry, the `register()` method of `app/Exceptions/Handler.php` replaces `bootstrap/app.php`:

```php
use Sentry\Laravel\Integration;
use Throwable;

public function register(): void
{
    $this->reportable(function (Throwable $e) {
        Integration::captureUnhandledException($e);
    });
}
```

Laravel 10 has not received security fixes since February 2025: plan the upgrade.

### Next.js

Versions: Next.js 15 and 16; Vercel dashboard, November 2026.

On Vercel, the project's `Logs` tab filters requests by status code and shows function logs; alerts depend on the plan or on an error tracking integration. When self-hosting, log the process errors (`pm2 logs`, `journalctl`) and use the `instrumentation.ts` file, whose `onRequestError` hook receives server errors, to forward them to your tracking service.

### Weekly review in Search Console and Bing

Every week, ten minutes:

1. [Page indexing report](https://search.google.com/search-console/index): number of URLs under “Server error (5xx)”, examples, templates.
2. [Crawl stats](https://search.google.com/search-console/settings/crawl-stats): host status, share of server error responses, trend in the number of requests and in the average response time.
3. Bing Webmaster Tools: [Site Explorer](https://www.bing.com/webmasters/siteexplorer) flags URLs in error folder by folder.
4. Copy the figures into your tracking sheet and open an incident for any increase.

## Common mistakes

- **Monitoring only the homepage**: it is cached and responds even when the application fails.
- **Relying on Search Console as an alert**: its data arrives several days late.
- **Alerting on every error**: the noise makes people ignore the real alerts.
- **A probe hosted on the server being monitored**: it goes down with it.
- **Error pages with `200`**: they escape the metrics; an error must keep its 5xx code.
- **Logs without response times**: no way to see 504s coming.
- **Nobody designated**: an alert without an owner goes nowhere.

## Frequently asked questions

### How can I get alerted when my site returns 500 errors?

Regularly calculate the rate of 5xx responses in the logs of the server, the CDN or the load balancer, and trigger an alert above a threshold, for example 1 to 2% of requests for ten minutes. Add an error tracking service that reports each new application exception, and an external probe that tests a dynamic page. Search Console serves as a weekly check, not as an alert.

### Is Search Console enough to monitor server errors?

No. Search Console shows the 5xx errors Googlebot encountered, but its reports update several days late and only cover the URLs Google has crawled. It remains essential for measuring the effect of errors on crawling and indexing, but detection must rely on your logs, your hosting metrics and exception tracking.

### What 5xx error rate is acceptable?

No search engine publishes a threshold. In practice, a rate close to zero is the norm for a healthy site, and a few isolated errors during a deployment have no consequence. What matters is duration and concentration: errors repeated for several days on the same URLs can make them drop out of Google's index, and a high rate across the whole site slows down crawling.

### Do I need a paid tool to monitor server errors?

No. A scheduled script that calculates the 5xx rate from the logs, GoAccess for a weekly report, self-hosted Uptime Kuma for probes and Search Console cover the essentials for free. Paid error tracking and performance monitoring services add exception grouping, history and finer-grained alerts, which are useful on a high-traffic site.

## Resources

- [Google: How HTTP status codes affect Google's crawlers](https://developers.google.com/search/docs/crawling-indexing/http-network-errors?hl=en)
- [Search Console Help: Crawl Stats report](https://support.google.com/webmasters/answer/9679690?hl=en)
- [Search Console Help: Page indexing report](https://support.google.com/webmasters/answer/7440203?hl=en)
- [Nginx: log module](https://nginx.org/en/docs/http/ngx_http_log_module.html)
- [Amazon CloudWatch: CloudWatch metrics for your Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html)
- [Cloudflare: Available notifications](https://developers.cloudflare.com/notifications/notification-available/)
- [Laravel: Logging](https://laravel.com/docs/logging) and [Sentry for Laravel](https://docs.sentry.io/platforms/php/guides/laravel/)
- [GoAccess: documentation](https://goaccess.io/man)

Next steps: [fix 5xx errors](https://checklist-seo-geo.com/en/http-redirects/fix-5xx-errors), [monitor HTTP status codes and uptime](https://checklist-seo-geo.com/en/automation-quality-control/monitor-http-status-codes-uptime) and [analyze server logs](https://checklist-seo-geo.com/en/crawling/analyze-server-logs).
