Apache Combined Log Format
advancedParses Apache/Nginx combined log format entries.
logapachenginxserverparsing
Pattern
/(\S+) (\S+) (\S+) \[(.+?)] "(\S+) (\S+) (\S+)" (\d{3}) (\d+|-) "([^"]*)" "([^"]*)"/gTry It
0 of 3 strings matched
Explanation
Captures 11 fields from Apache combined log: IP, ident, user, timestamp, method, path, protocol, status code, response size, referer, and user agent.
Test Strings
Matching
- 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /index.html HTTP/1.1" 200 2326 "http://example.com/" "Mozilla/5.0"
Non-matching
- just some text
- 127.0.0.1 - -
Language Compatibility
| Language | Support |
|---|---|
| JS | Full support |
| PYTHON | Full support |
| JAVA | Full support |
| PHP | Full support |
| GO | Full support |
Code Snippets
const regex = /(\S+) (\S+) (\S+) \[(.+?)] "(\S+) (\S+) (\S+)" (\d{3}) (\d+|-) "([^"]*)" "([^"]*)"/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);