Web ✓ fields verified against sample logs

nginx Access Log Format: combined Fields Explained With Examples

Published

One line per HTTP request, in the combined format nginx and Apache share: the client address, the authenticated user, the time, the request line, the response status and size, the referrer and the user agent.

Official documentation: nginx: ngx_http_log_module (log_format, the combined format) · nginx: embedded variables (ngx_http_core_module) · Apache: Log Files (Combined Log Format)

Sample record

10.10.1.50 - alice [07/Jun/2026:09:00:00 +0000] "GET /api/v1/dashboard HTTP/1.1" 200 8432 "https://app.internal.corp.com/dashboard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
10.10.1.50 - alice [07/Jun/2026:09:00:15 +0000] "GET /api/v1/users/profile HTTP/1.1" 200 1204 "https://app.internal.corp.com/profile" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"

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
$remote_addre.g. 185.220.101.45 IP address nginx: "client address" — the address of the peer that opened the connection. Behind a load balancer or CDN this is the proxy; unless real_ip is configured, every request shows the same few addresses and per-client counting is meaningless.
$remote_usere.g. alice string or "-" nginx: "user name supplied with the Basic authentication". A hyphen when there was none. The name the client sent, whether or not the password was right; a 401 next to it is a failed Basic login.
$time_locale.g. 07/Jun/2026:09:00:00 +0000 date-time nginx: "local time in the Common Log Format", with the server's offset from UTC. Logged when the request finishes; convert with the offset before joining with other sources.
$requeste.g. POST /api/v1/auth/login HTTP/1.1 string nginx: "full original request line" — method, path with query string, protocol. Probes, traversal and injection payloads are in here, often percent-encoded; decode before matching.
$statuse.g. 401 number nginx: "response status". Bursts of 401 on a login path are guessing; 404 bursts across odd paths are scanning; 200 after many 401s from one address is a guess that worked.
$body_bytes_sente.g. 8432 number nginx: "number of bytes sent to a client, not counting the response header". A response far larger than the endpoint's usual size can be a bulk export or a successful injection dumping rows.
$http_referere.g. https://app.internal.corp.com/dashboard string or "-" The Referer request header, logged through nginx's "arbitrary request header field" variable. Scripts usually send none ("-"); a page that is only ever reached by direct request is a sign of automation.
$http_user_agente.g. python-requests/2.28.0 string The User-Agent request header, as the client sent it. Tools announce themselves here (python-requests, sqlmap, zgrab); a browser string proves nothing, since anyone can send one.

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 one line per request to its access log. Unless a site defines its own log_format, the line follows the predefined combined format, which nginx gives as $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" in its log module documentation. Each $ name is an nginx variable: who connected, who authenticated with Basic auth, when, what they asked for, what they got back and how big it was, where they came from and what client they said they were. Apache’s Combined Log Format has the same columns, so this page covers both.

The malicious samples show the attacks this log is best at: a script posting to a login endpoint dozens of times a second with 401 responses, a sweep through .env, .git and admin paths returning 404s, and SQL injection in the query string followed by unusually large 200 responses.

Where to get it

  • On the server. Packaged nginx writes /var/log/nginx/access.log (rotated by logrotate into access.log.1, access.log.2.gz…); the access_log directive in each server block can point elsewhere.
  • Containers. The official image sends the access log to standard output, so docker logs or the platform’s log collector holds it.
  • Custom formats. Check the log_format lines in the configuration: many sites add fields such as $request_time or $http_x_forwarded_for, which shifts every column after them.
# Requests per client address, most active first
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# Addresses with the most 401 responses
awk '$9 == 401 {print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head

Parsing pitfalls

  • Quotes, not spaces. The request, referrer and user agent are quoted and contain spaces; split on the quoted fields, not on whitespace. The awk columns above only work for the plain combined format.
  • Escaped bytes. nginx escapes control and non-ASCII characters in logged values as \xXX; attack payloads often arrive that way and need decoding before matching.
  • Percent-encoding. Paths and queries are logged as sent, so %2e%2e%2f is ../ — decode before looking for traversal or injection.
  • Invalid request lines. Scanners send raw TLS or junk to port 80; nginx logs them with status 400 and a $request that is not a request line at all.
  • Proxied clients. $remote_addr is the proxy unless real_ip is configured.

Detection ideas

  • Password guessing: many POST requests to a login path with status 401 from one address, or 200 after a run of 401s — the credential stuffing rule.
  • Scanning: 404s across /.env, /.git/config, wp-login.php and admin paths; see the web probe reference for what each probe looks for.
  • Injection and exfiltration: SQL fragments in $request followed by large $body_bytes_sent — the SQL injection rule.
  • Tools and crawlers: $http_user_agent values such as python-requests, zgrab or a fake Googlebot; the scanner user-agent reference explains the common ones.

The free browser analyzer runs these checks on an access log without uploading it, and the log line explainer explains a single line.

Sending nginx / Apache Combined to an LLM

One megabyte of this format is about 634,806 tokens on current Claude models and 462,316 on GPT models, measured with the models' own tokenizers — so a gigabyte sent raw to Claude Sonnet 5.5 costs about $1,270 in input tokens alone (prices of 2026-10-24). Estimate your own volume →

Detections and guides for nginx / Apache Combined

Frequently Asked Questions

What is the format of an nginx access log line?
By default nginx writes the combined format, which nginx documents as $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent". The hyphen after the address is a fixed placeholder (Apache writes the identd user there). Apache's Combined Log Format produces the same layout, so one parser reads both.
Why does every request come from the same IP address?
$remote_addr is the address of whoever opened the TCP connection. Behind a load balancer, reverse proxy or CDN that is the proxy. To log the visitor, configure the real_ip module to take the address from a trusted X-Forwarded-For or X-Real-IP header, or add that header to the log format and read it instead.
Is the time in an nginx log UTC?
Not necessarily. $time_local is local time with its offset, such as +0000 or +0200, and it is written when the request completes. Convert using the offset before building a timeline with other logs; nginx's $time_iso8601 variable is an alternative if you control the format.
Does $body_bytes_sent include headers?
No. nginx defines it as the number of bytes sent to the client, not counting the response header; $bytes_sent includes the headers. A 200 response to a login page that is much larger than usual can still indicate an error page or a data dump, so compare with the endpoint's normal sizes.

Analyze a nginx / Apache Combined 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]