Nginx Access Log Regex Generator
Generate named capture groups for Nginx combined access logs locally in the browser.
203.0.113.7 - - [27/Apr/2026:10:12:44 +0000] "GET /api/users?id=1 HTTP/1.1" 200 1234 "-" "Mozilla/5.0"
Generate named capture groups for Nginx combined access logs locally in the browser.
This tool runs locally in your browser. Your input is not uploaded.
Copy the generated result or open the full tool to adjust inputs locally.
203.0.113.7 - - [27/Apr/2026:10:12:44 +0000] "GET /api/users?id=1 HTTP/1.1" 200 1234 "-" "Mozilla/5.0"
JavaScript regex
/^(?<ip>\S+)\s+\S+\s+\S+\s+\[(?<timestamp>[^\]]+)\]\s+"(?<method>[A-Z]+)\s+(?<path>\S+)\s+HTTP\/[\d.]+"\s+(?<status>\d{3})\s+\S+(?:\s+"[^"]*")?(?:\s+"(?<userAgent>[^"]*)")?.*$/m
Python regex
r"^(?P<ip>\\S+)\\s+\\S+\\s+\\S+\\s+\\[(?P<timestamp>[^\\]]+)\\]\\s+\"(?P<method>[A-Z]+)\\s+(?P<path>\\S+)\\s+HTTP\\/[\\d.]+\"\\s+(?P<status>\\d{3})\\s+\\S+(?:\\s+\"[^\"]*\")?(?:\\s+\"(?P<userAgent>[^\"]*)\")?.*$"
Field table
| Field | Capture group |
| --- | --- |
| ip | `ip` |
| timestamp | `timestamp` |
| method | `method` |
| path | `path` |
| status | `status` |
| userAgent | `userAgent` |
Preview
Line 1: matched (ip=203.0.113.7, timestamp=27/Apr/2026:10:12:44 +0000, method=GET, path=/api/users?id=1, status=200, userAgent=Mozilla/5.0)
Python snippet
import re
pattern = re.compile(r"^(?P<ip>\\S+)\\s+\\S+\\s+\\S+\\s+\\[(?P<timestamp>[^\\]]+)\\]\\s+\"(?P<method>[A-Z]+)\\s+(?P<path>\\S+)\\s+HTTP\\/[\\d.]+\"\\s+(?P<status>\\d{3})\\s+\\S+(?:\\s+\"[^\"]*\")?(?:\\s+\"(?P<userAgent>[^\"]*)\")?.*$")
match = pattern.search(line)
if match:
fields = match.groupdict()
JavaScript snippet
const pattern = /^(?<ip>\S+)\s+\S+\s+\S+\s+\[(?<timestamp>[^\]]+)\]\s+"(?<method>[A-Z]+)\s+(?<path>\S+)\s+HTTP\\/[\d.]+"\s+(?<status>\d{3})\s+\S+(?:\s+"[^"]*")?(?:\s+"(?<userAgent>[^"]*)")?.*$/m;
const match = line.match(pattern);
const fields = match?.groups ?? {};Generate named capture groups for Nginx combined access logs locally in the browser.
203.0.113.7 - - [27/Apr/2026:10:12:44 +0000] "GET /api/users?id=1 HTTP/1.1" 200 1234 "-" "Mozilla/5.0"
No. It generates a practical starter for common formats and shows warnings when manual adjustment is likely.
No. Generation and preview run locally in the browser.
Named groups make downstream parsing clearer because each extracted value is labeled by field name.