我记录了 Splunk 中出现的语句,如下所示。
info Request method=POST, time=100, id=12345
info Response statuscode=200, time=300, id=12345
我正在尝试编写一个 Splunk 查询,该查询将从 info Request 和 info Response 开头的行中提取时间参数,并基本上找到时间差。有没有办法在查询中做到这一点?我能够从每个语句中分别提取值,但不能同时提取两个值。
我希望得到类似下面的东西,但我猜管道不起作用:
... | search log="info Request*" | rex field=log "time=(?<time1>[^\,]+)" | search log="info Response*" | rex field=log "time=(?<time2>[^\,]+)" | table time1, time2
非常感谢任何帮助。