Nginx Status Code Regex Generator
Generate named capture groups for Nginx health-check and status logs locally in the browser.
203.0.113.8 - - [27/Apr/2026:11:12:44 +0000] "GET /health HTTP/1.1" 503 18 "-" "kube-probe/1.30"
Generate named capture groups for Nginx health-check and status logs locally in the browser.
此工具在你的浏览器本地运行。你的输入不会被上传。
Copy the generated result or open the full tool to adjust inputs locally.
203.0.113.8 - - [27/Apr/2026:11:12:44 +0000] "GET /health HTTP/1.1" 503 18 "-" "kube-probe/1.30"
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.8, timestamp=27/Apr/2026:11:12:44 +0000, method=GET, path=/health, status=503, userAgent=kube-probe/1.30)
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 health-check and status logs locally in the browser.
203.0.113.8 - - [27/Apr/2026:11:12:44 +0000] "GET /health HTTP/1.1" 503 18 "-" "kube-probe/1.30"
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.