Regular Expressions 101

Community Patterns

Apache2 Access Log parsing

2

Regular Expression
PCRE (PHP <7.3)

/
^(\S*).*\[(.*)\]\s"(\S*)\s(\S*)\s([^"]*)"\s(\S*)\s(\S*)\s"([^"]*)"\s"([^"]*)"$
/

Description

This breaks down an Apache2 access log into 9 parts. I use this for analyzing content in my webserver logs.

Submitted by Kevin Loverde - 9 years ago