Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(?:time=\"(?<longtime>\d{4}-\d{2}-\d{2}\D{1}\d{2}:\d{2}:\d{2}\+\d{2}:\d{2})\") (?:level=(?<level>(info|warn|error))) (?:msg=\"(?<msg>.*)\") (((?:duration=(?<duration>\d{1,9}.\d{1,9})) (?:gitaly_embedded=(?<gitaly_embedded>[^ ]+)) (?:method=(?<method>(POST|GET))))|((?:body="(?<body>.*)") (?<code>code=\d{3}) (?:method=(?<method2>(POST|GET)))|(?<command>command=".*"))|(?:key_id=key-(?<key_id>)\d{3})) (?:pid=(?<pid>\d{1,5})) (?:url=\"(((?<url>.*)\"))|(?:user="(?<user>.*)")|(?:public_key="(?<public_key>.*)"))
/
gm

Description

Gitlab log for td-agent

Submitted by anonymous - 6 years ago