Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^t=(?<longtime>[^ ]+)\s*lvl=(?<loglevel>[^ ]+)\s*msg=(?<msg>(?:"[^"]+"|[^ ]+))\s*logger=(?<logger>[^ ]+)\s*(?:addresses=(?<email>(?:"\[[^"]+\]"|[^ ]+)))?(?:userId=(?<userID>[^ ]+))?\s*(?:orgId=(?<orgID>[^ ]+))?\s*(?:uname=(?<uname>[^ ]+|[??]*))?\s*(?:method=(?<method>[^ ]+))?\s*(?:path=(?<path>(?:"[^"]+"|[^ ]+)))?\s*(?:ruleId=(?<ruleID>[^ ]+))?\s*(?:name=(?<name>(?:"[^"]+"|[^ ]+)))?\s*(?:error=(?<error>(?:"[^"]+"|[^ ]+)))?\s*(?:changing state to=(?<ChStateTo>[^ ]+))?\s*(?:status=(?<status>[^ ]+))?\s*(?:remote_addr=(?<remote_addr>[^ ]+))?\s*(?:time_ms=(?<time_ms>[^ ]+))?\s*(?:size=(?<size>[^ ]+))?\s*(?:referer=(?<referer>(?:"[^"]+"|[^ ]+)|[??]*))?\s*(?:alertId=(?<alertID>[^ ]+))?\s*(?:newState=(?<NewState>[^ ]+))?\s*(?:prev state=(?<prevState>[^ ]+))?\s*(?:url=(?<url>[^ ]+))?$
/
gm

Description

td-agent regexp

Submitted by anonymous - 5 years ago