首页 > 解决方案 > GCP Cloud Sql使用正则表达式提取查询持续时间

问题描述

Stackdriver 日志记录指标创建者,尝试解析日志的 textPayload 以创建查询响应图
我目前有一个 GCP Stackdriver Logging Metric Editor 不接受的正则表达式。
(?<=duration: )(-?[0-9]+(?:[,.][0-9]+)?)(?= ms)我在哪里得到反馈Regular expression must be valid and include exactly one non-empty match group, indicated by parentheses.
链接到我最初创建它的位置:regexr.com/4t3hl
"[19087]: [612-1] db=test_database,user=test LOG: duration: 0.877 ms statement: COMMIT;"
有谁知道我需要做什么来使用这个正则表达式提取查询响应时间?

标签: regexpostgresqlgoogle-cloud-platformgoogle-cloud-sqlstackdriver

解决方案


推荐阅读