Web ✓ fields verified against sample logs

nginx Error Log Format: Fields, Levels and Examples

Published

One line per problem nginx hit while serving: the time, the severity, the worker process and thread, the connection number, the message, and — when a request caused it — the client address, the server block, the request line and the Host header.

Official documentation: nginx: error_log directive (levels) · nginx: log_not_found directive · nginx: ngx_http_auth_basic_module

Sample record

2026/10/26 09:15:22 [error] 30#30: *221 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.0.2.10, server: shop.example.com, request: "GET /favicon.ico HTTP/1.1", host: "shop.example.com", referrer: "https://shop.example.com/"

From the LogTriage parser test corpus — synthetic data, no real hosts or users.

Explain this record field by field →

Field reference

Field Type Meaning Why it matters for security
timee.g. 2026/10/27 03:41:10 YYYY/MM/DD HH:MM:SS When nginx wrote the message, in the server's local time, without a zone. Match it to the access log entry for the same client and request; the access log writes the request when it finishes.
levele.g. error string The severity in brackets — nginx's levels are debug, info, notice, warn, error, crit, alert and emerg; the error_log directive sets the lowest one written. Failed file opens and Basic auth failures are error level, so they appear at the default setting.
pide.g. 31 number The worker process ID, written before the "#". Ties a burst of errors to one worker; a changing pid after a crash or reload is worth noticing.
tide.g. 31 number The thread ID, after the "#"; equal to the pid on Linux workers without thread pools. Rarely needed for investigation.
connectione.g. 1041 number The connection number after "*", a counter of client connections in that worker. Messages with the same number belong to one client connection — several requests on a kept-alive connection share it.
messagee.g. user "admin": password mismatch string What happened — open() failed with the operating system error, access forbidden by rule, a Basic auth result, an upstream timeout. The verdict to filter on; open() failures for .env or .git are probes, password mismatch is guessing.
cliente.g. 198.51.100.23 IP address The client address of the request that caused the message. The address to count; behind a proxy it is the proxy unless real_ip is configured.
servere.g. shop.example.com string The server_name of the server block that handled the request. Shows which site was targeted when one nginx serves several.
requeste.g. GET /.env HTTP/1.1 string The request line, quoted. The path the scanner wanted; the same paths across many lines from one client is a sweep.
hoste.g. shop.example.com string The Host header the client sent, quoted. An IP address or an unknown name here means the scanner hit the server directly rather than through your domain.
upstreame.g. http://127.0.0.1:8080/reports/annual URL The backend nginx was proxying to when the error happened. Timeouts and connection refusals to one upstream under unusual request patterns can be a slow attack on the application.

Have one of your own records? Paste it into the log line explainer and each field is explained from this table, with times, codes and addresses decoded — in your browser.

What it records

nginx writes problems to its error log as time [level] pid#tid: *connection message, followed by context when a client request was involved: , client: …, server: …, request: "…", host: "…", and upstream: or referrer: when relevant. The error_log directive sets the file and the lowest level written.

What lands here complements the access log. For a missing file nginx records the open() that failed and the full filesystem path it tried; for a denied location, access forbidden by rule; for Basic authentication, whether the password was wrong or the user unknown — details the access log’s status code alone does not give. The malicious sample shows a scanner’s sweep (.env, .git/config, .aws/credentials, wp-login.php, phpinfo.php, the PHPUnit eval-stdin.php exploit path, Spring actuator/env), forbidden server-status and phpmyadmin, and then a password attack on /admin/ with both wrong passwords and unknown users.

Where to get it

  • The file. /var/log/nginx/error.log on packaged installs; check error_log lines in nginx.conf and server blocks for others.
  • Level. error_log /var/log/nginx/error.log warn; writes warn and above; the probes and auth failures on this page are error level, so they are kept at the usual settings.
  • Containers. The official image sends the error log to standard error.
# Clients with the most Basic-auth failures, then the paths a scanner tried
grep -E "password mismatch|was not found in" /var/log/nginx/error.log | grep -oE "client: [0-9a-f.:]+" | sort | uniq -c | sort -rn
grep 'open() ' /var/log/nginx/error.log | grep -oE 'request: "[^"]*"' | sort | uniq -c | sort -rn | head

Parsing pitfalls

  • Context is optional. Startup and worker messages have no client:; only request-driven errors carry it.
  • Commas inside values. request: and host: are quoted and may contain commas; split on , key: boundaries, not on every comma.
  • No zone. Times are local and carry no offset; the format has no year problem but does have a time-zone one.
  • Two paths. The message holds the filesystem path (/usr/share/nginx/html/.env); request: holds the URL path. Use the URL for probe matching.
  • Level filters. Raising error_log to crit hides everything on this page.

Detection ideas

  • Scanning: many open() … failed or access forbidden by rule lines from one client across probe paths — see the web probe reference.
  • Basic auth guessing: password mismatch and was not found in lines from one client, especially with many user names.
  • Exploit attempts: requests for known vulnerable paths such as PHPUnit’s eval-stdin.php with POST.
  • Backend stress: bursts of upstream timeouts or connection refusals tied to one client or path.

The free browser analyzer reads nginx error logs and runs these checks locally, and the log line explainer splits a single line into these fields.

Frequently Asked Questions

Where is the nginx error log?
Packaged nginx writes /var/log/nginx/error.log; the error_log directive in the main, http, server or location context can change the file and the lowest level written. The official Docker image sends it to standard error, so docker logs shows it.
Why does the nginx error log have a line for every 404?
When a request asks for a file that does not exist, nginx logs the failed open() at error level, with "(2: No such file or directory)". The log_not_found directive, on by default, controls this. Scanners therefore leave a trace in the error log as well as the access log, with the full file path nginx tried.
How does nginx log Basic authentication failures?
With ngx_http_auth_basic_module, a wrong password for an existing user is logged as user "name": password mismatch, and an unknown user as user "name" was not found in followed by the password file. Both are error level and carry the client address, so counting them per client finds password guessing.
What is the *1041 in an nginx error line?
It is the connection number: nginx counts client connections and writes the number after an asterisk. Every message about the same client connection shares it, which is how to group the errors one client produced over a kept-alive connection.

Analyze a nginx error log file in your browser

The free analyzer detects this format, parses every field above and flags attack patterns — the file never leaves your machine. For threat-intel enrichment and an AI-written incident report, run it through LogTriage.

Investigating something right now? LogTriage checks every address in the file against threat intelligence and writes the incident report: 10 analyses a month free. The incident pack adds the in-depth AI analysis and files up to 100 MB: 25 analyses for $19, one payment, no subscription. Pricing

How this page was made. The official definitions, field names and examples on it are copied by script from the sources it links and re-checked against them on every build. The investigation advice was drafted with AI from those sources and passed a separate review before publishing. What is checked, and how · found a mistake? [email protected]