Skip to main content
Regexflux

Apache Combined Log Format

advanced

Parses Apache/Nginx combined log format entries.

logapachenginxserverparsing

Pattern

/(\S+) (\S+) (\S+) \[(.+?)] "(\S+) (\S+) (\S+)" (\d{3}) (\d+|-) "([^"]*)" "([^"]*)"/g

Try 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

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull 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);

Related Patterns