Problems / Parse Log Lines / Editorial
regexp_extract(raw_line, '^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})', 1)
CAST(... AS TIMESTAMP)
\[(\w+)\]
[...]
\[\w+\] (.*)$
level IN ('ERROR', 'WARN')
log_id
Semi-structured logs are parsed by anchoring on the rigid parts (position of the timestamp, the bracketed level) and capturing the free-form remainder. Doing the extraction in a CTE keeps the filter readable — the outer query works on named, typed columns instead of repeating three regex calls in the WHERE clause.
WHERE
Solve Parse Log Lines yourself →