Apache Access Log Regex Generator
Generate named capture groups for Apache combined access logs locally in the browser.
198.51.100.4 - frank [27/Apr/2026:10:15:12 +0000] "POST /checkout HTTP/1.1" 500 532 "-" "curl/8.0"
Generate named capture groups for Apache 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.
198.51.100.4 - frank [27/Apr/2026:10:15:12 +0000] "POST /checkout HTTP/1.1" 500 532 "-" "curl/8.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=198.51.100.4, timestamp=27/Apr/2026:10:15:12 +0000, method=POST, path=/checkout, status=500, userAgent=curl/8.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 Apache combined access logs locally in the browser.
198.51.100.4 - frank [27/Apr/2026:10:15:12 +0000] "POST /checkout HTTP/1.1" 500 532 "-" "curl/8.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.