Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}(?:Z|[+-]\d{2}:\d{2}))\s*(\w+)\s*(\d*)\s*---\s*\[\s*([a-zA-Z0-9\._-]+)?\]\s*([^\s]+)\s*:\s*([^\n]+)$
"
mg

Description

Parses default spring boot logs and capture the following groups: i. ISO Timestamp, ii. Log Level, iii. Process ID (PID), iv. Thread name, v. Logger name, and vi. Log message

Submitted by Snehangshu Bhattacharya - 2 years ago