Skip to Content
Log sources
Next: these pages describe unreleased changes on the develop branch. Read the docs for the current release

nginx error logs

Tail nginx error logs to group recurring failures into problems and match them to Access Logs requests.

Access logs show that a request returned 502. The proxy's error log says why. Point GeoMetrikks at your nginx error log to browse individual error lines, group repeated messages into problems, and jump between error lines and the Access Logs requests behind them.

What you get

  • Error Logs page. Appears in the sidebar after Access Logs, and under More on phones, once LOGPARSER_ERROR_LOG_PATHS is set on this instance or at least one error line is in the database. Press G then E on desktop to jump straight to it. The page opens on Problems, which groups lines by message shape and level and shows a timeline, sparklines, counts, hosts, upstreams, and first-seen and last-seen times. Problems first seen in the last 24 hours carry a new badge, and the sidebar counts active new problems. The Lines tab lists individual error lines with their request fields, client geo, probable Access Logs match and raw line.
  • Probable proxy error on Access Logs. Opening a 4xx or 5xx row in Access Logs shows a Probable proxy error card above its fields when a matching error line exists. The card shows the error message, level, upstream and server, with Open error line and Problem · N lines in range links into Error Logs.
  • Proxy errors in the IP inspector. The IP inspector adds a Proxy errors section showing up to 5 top problems for that address in the selected range, with a Show N lines in Error Logs link. It appears even when that IP has no Access Logs rows.
  • Error log sources on Settings > Status. When this instance has paths in LOGPARSER_ERROR_LOG_PATHS, the Ingestion section on Settings > Status adds an Error log sources list showing each file, its state and lines read since startup. It appears whether access ingestion is on or off. Error sources never change /health or the Ingestion verdict, and there is no staleness check because a quiet error log is the healthy case.

Stored error lines age out after ANALYTICS_RAW_RETENTION_DAYS, 180 days by default. Each problem keeps its first-seen time past retention without keeping any client IP or raw line, so a returning problem doesn't show up as new again. LOGPARSER_IGNORE_IPS drops matching clients at ingest, and Muted IPs and Hide my IP filter Error Logs the same way they filter Access Logs.

Crafted requests can name another client

nginx writes the request text, such as the URL and the Referer, into the same unescaped line as its own fields, such as client:. A crafted URL or Referer can make an error line show another client IP. That changes which client Error Logs shows for the line and whether LOGPARSER_IGNORE_IPS drops it. The Probable proxy error card in Access Logs and the Proxy errors section of the IP inspector match on that address, so a crafted line can show up there for the wrong client. The client addresses stored for Access Logs come from the access log, never from the error log. Automatic bans and block lists never read the client IP of an error line. Ban and the Report to items in a docked line's menu do act on the IP the line names, so check it against the matched access request before you use them.

The nginx error_log directive and levels

nginx writes error logs with the error_log directive:

error_log /var/log/nginx/error.log warn;

nginx levels run from most to least severe: emerg, alert, crit, error, warn, notice, info and debug. Choosing a level writes lines at that level and every level more severe. GeoMetrikks stores every level written to the file.

LevelWhat it adds
warnGood default. Captures emerg, alert including CrowdSec Lua bouncer block notices, crit TLS handshake failures, error upstream and file failures, and warn lines such as rate limiting and buffered bodies.
errorSkips warnings if you want fewer lines.
notice, info, debugRoutine chatter such as clients closing connections early and worker notices. Adds noise and database rows without pointing to failures.

Mount the directory, not the file

Mount the folder that holds the error log read-only into the GeoMetrikks container, not the individual log file. Mounting one file binds Docker to its inode. When logrotate renames the file and nginx opens a new one, the container stays on the old inode and misses every line written after rotation.

The shipped docker-compose.yml mounts ACCESS_LOG_DIR read-only at /var/log/access. When nginx writes its error log in the same folder as its access log, no extra mount is needed. When the error log lives in another folder, mount that folder read-only in docker-compose.yml and point LOGPARSER_ERROR_LOG_PATHS at the file inside it.

Set up your proxy

Plain nginx

Most nginx packages log to /var/log/nginx/error.log. Set the level in nginx.conf and reload nginx:

error_log /var/log/nginx/error.log warn;

With ACCESS_LOG_DIR=/var/log/nginx already mounted at /var/log/access, add LOGPARSER_ERROR_LOG_PATHS and your proxy's time zone in TZ to .env, then run docker compose up -d. Time zones explains why TZ matters.

LOGPARSER_ERROR_LOG_PATHS=/var/log/access/error.log
TZ=Europe/Oslo

SWAG

SWAG and other linuxserver nginx images write the error log to /config/log/nginx/error.log inside their config volume, in the same folder as access.log. With ACCESS_LOG_DIR pointing at that folder on the host, add LOGPARSER_ERROR_LOG_PATHS and TZ to .env and run docker compose up -d. Use the same TZ as the SWAG container:

ACCESS_LOG_DIR=/opt/swag/log/nginx
LOGPARSER_ERROR_LOG_PATHS=/var/log/access/error.log
TZ=Europe/Oslo

Nginx Proxy Manager

Nginx Proxy Manager writes a separate proxy-host-<id>_error.log file for each proxy host. Instead of tailing every host file, add one combined error log in /data/nginx/custom/server_proxy.conf, the same file used for the Nginx Proxy Manager access log:

error_log /data/logs/geometrikks_error.log warn;

NPM includes server_proxy.conf in every proxy host's server block, so hosts you add later log there too. NPM's built-in logrotate rule covers /data/logs/*_error.log, so this file rotates alongside NPM's own error logs and GeoMetrikks follows the rotation.

Check the config and reload nginx inside the NPM container:

docker exec <npm-container> sh -c 'nginx -t && nginx -s reload'

Then point GeoMetrikks at the combined file in .env, set TZ to the NPM container's time zone, and run docker compose up -d:

ACCESS_LOG_DIR=/path/to/npm/data/logs
LOGPARSER_ERROR_LOG_PATHS=/var/log/access/geometrikks_error.log
TZ=Europe/Oslo

Tail only geometrikks_error.log, not NPM's per-host proxy-host-*_error.log files alongside it. nginx writes to every error_log in scope, so tailing both stores every line twice.

server_proxy.conf covers proxy hosts only. To log redirection or 404 hosts to the same file, add the same error_log line to server_redirect.conf or server_dead.conf.

Time zones

nginx writes error log timestamps in local time with no UTC offset, such as 2026/12/04 14:22:10. GeoMetrikks converts them to UTC using the source's time zone.

Set TZ on the GeoMetrikks container to match your proxy's IANA time zone, such as Europe/Oslo or America/New_York. The shipped docker-compose.yml passes .env to the container, so a TZ line there is enough. When LOGPARSER_ERROR_LOG_TIMEZONES is unset, GeoMetrikks uses TZ if it is a valid IANA name, dropping a leading :, and falls back to UTC otherwise. It logs a warning at startup when it falls back because TZ is unset or isn't an IANA name. A proxy that writes UTC needs TZ=UTC.

If a proxy uses a different time zone from the GeoMetrikks container, or one instance reads logs from proxies in different zones, set LOGPARSER_ERROR_LOG_TIMEZONES to one IANA zone or a JSON list matching LOGPARSER_ERROR_LOG_PATHS by position:

LOGPARSER_ERROR_LOG_PATHS=["/var/log/access/eu-error.log", "/var/log/access/us-error.log"]
LOGPARSER_ERROR_LOG_TIMEZONES=["Europe/Oslo", "America/New_York"]

During a daylight saving time fall-back overlap, GeoMetrikks uses the first occurrence of the repeated hour.

Several error logs and server names

LOGPARSER_ERROR_LOG_PATHS takes one path or a JSON list. LOGPARSER_ERROR_LOG_FORMATS, LOGPARSER_ERROR_LOG_TIMEZONES and LOGPARSER_ERROR_LOG_SERVER_NAMES each take one value applied to every path, or a JSON list of the same length matched by position. Only nginx is accepted for LOGPARSER_ERROR_LOG_FORMATS. See Log parser settings for every variable and its default.

By default, every error log records the first value of LOGPARSER_SERVER_NAME, which is your GeoMetrikks server name rather than nginx's server_name. When one instance tails several access logs under different LOGPARSER_SERVER_NAME values, set LOGPARSER_ERROR_LOG_SERVER_NAMES so each error log carries the same server name as the access log it belongs to:

LOGPARSER_ERROR_LOG_PATHS=["/var/log/access/edge-01-error.log", "/var/log/access/edge-02-error.log"]
LOGPARSER_ERROR_LOG_SERVER_NAMES=["edge-01", "edge-02"]

Access Logs matching requires the same server name on both sides. If an error log's server name differs from the access log's, none of its lines match Access Logs rows.

Error-only agents

Error log ingestion runs whenever LOGPARSER_ERROR_LOG_PATHS is set, independent of LOGPARSER_ENABLED.

To run an agent with APP_MODE=agent that reads only error logs, set LOGPARSER_ENABLED=false alongside LOGPARSER_ERROR_LOG_PATHS and LOGPARSER_ERROR_LOG_SERVER_NAMES, or LOGPARSER_SERVER_NAME. An error-only agent tails no access logs and adds no map location for itself. See Multiple sources for deploying agents.

On a head that tails no error logs of its own, the Error Logs page appears in the sidebar once an agent writes its first error line. Settings > Status lists only the head's own error log sources.

How Problems grouping works

GeoMetrikks builds a signature for each line by replacing variable parts of the message with placeholders:

  • IPv4 and IPv6 addresses become <ip>
  • URLs become <url>
  • quoted strings become "<s>" or '<s>'
  • UUIDs become <uuid>
  • hex runs, either 0x... or word-bounded runs of 8 or more hex characters with at least one letter a to f, become <hex>
  • numbers become <n>
  • Lua prefixes replace the line number so [lua] crowdsec.lua:735: Allow(): becomes [lua] crowdsec.lua:<n>: Allow():

Four common messages keep their key fields through dedicated templates:

  • open() "<path>" failed (<errno>: <errno text>)
  • limiting requests, excess: <n> by zone "<zone>"
  • an upstream response is buffered to a temporary file <file> while reading upstream
  • [Crowdsec] denied '<ip>' with '<remediation>' (by <origin>)

Protocol tokens such as HTTP/1.1 and TLSv1.3, errno text such as (111: Connection refused) and the while ... phase nginx appends are kept as written. The same error in two different phases groups as two separate problems.

Each problem is keyed by format, level and signature. The same message logged at two levels becomes two problems. Upstreams are stored by origin, meaning scheme, host and port or a unix socket path, so errors across different request paths on one backend roll up together. The raw line keeps the full upstream value.

How probable Access Logs matching works

nginx writes no shared request ID between its access log and error log, so GeoMetrikks matches them by shared fields and time, and labels the link Probable proxy error in Access Logs and Probable access log match in Error Logs.

An error line and an access row match when:

  • server, HTTP method and url are the same,
  • the client IP is the same, treating IPv4 addresses and their ::ffff: IPv4-mapped IPv6 forms as equal,
  • host matches whenever both rows have one, ignoring ASCII letter case, port and a trailing dot, and
  • the error line's timestamp falls inside [access time - request time - 1 s, access time + 1 s], where a missing request time counts as 0 seconds and the lookback caps at 300 seconds.

When several candidates fit, the closest timestamp wins. From the Access Logs side, ties break by most severe level, then earliest timestamp, then lowest ID. In a docked problem, the Clients got summary runs this match on up to 50 of the problem's most recent lines in scope. Each line first takes its closest access request, and the summary counts that request only when it falls inside the selected range.

Several cases leave an error line with no match, or match an adjacent request:

  • Lines without a request. Startup messages, ngx.timer lines and lines missing a client IP, method or URL have no access row to match.
  • Private or unplaced clients. Error log ingestion keeps private, loopback, link-local and unplaced clients, while access log ingestion drops clients GeoIP cannot place. Those error lines stay in Error Logs with no matching Access Logs row.
  • Clock or time zone mismatch. If TZ or LOGPARSER_ERROR_LOG_TIMEZONES doesn't match the proxy's clock, converted UTC timestamps land outside the match window.
  • Different server names. If LOGPARSER_ERROR_LOG_SERVER_NAMES doesn't match the access log's LOGPARSER_SERVER_NAME, the two sides never match.
  • Requests longer than 5 minutes. Lookback stops at 300 seconds, so an error logged more than 5 minutes before a slow request finishes falls outside the window.
  • Special characters with the positional nginx access format. In positional access logs, nginx escapes quotes, backslashes and non-ASCII bytes as \xHH, while writing them raw in error logs, so those URLs do not match. Switching the access log to geometrikks-json avoids this.
  • Repeated identical requests. When the same client sends the same method and URL twice in one second, the match can point to the neighboring request.

On this page