Regular Expressions 101

Community Patterns

mysql slow log parse for aws log insights

0

Regular Expression
ECMAScript (JavaScript)

/
# Time:\s(?<timestamp>.*)\n#.*Id:\s(?<id>.*)\n#\sQuery_time:\s(?<duration>[\d.]*)\s.*time:\s(?<lock_time>[\d.]*)\s.*_sent:\s(?<returned>\d*)\s.*_examined:\s(?<searched>\d*)\n(?<sql>[\s\S]*)
/
gm

Description

Parse the CloudWatch mysql slowlog into coherent fields.

Submitted by Frank Baxter - 3 years ago