Logs

Apache Common Log Format

Parses Apache Common Log Format entries.

Try it in RegexPro

Pattern

regexJavaScript
/^(\S+) (\S+) (\S+) \[([^\]]+)\] "(\S+) (\S+) (\S+)" (\d{3}) (\d+|-)/

Raw source: ^(\S+) (\S+) (\S+) \[([^\]]+)\] "(\S+) (\S+) (\S+)" (\d{3}) (\d+|-)

How it works

Captures 9 fields: host, ident, user, timestamp, method, path, protocol, status code, and response size.

Examples

Input

127.0.0.1 - frank [10/Oct/2023:13:55:36 -0700] "GET /index.html HTTP/1.0" 200 2326

Matches

  • 127.0.0.1 - frank [10/Oct/2023:13:55:36 -0700] "GET /index.html HTTP/1.0" 200 2326

Common use cases

  • Log analysis
  • Traffic monitoring
  • Security audits