在Sumo Logic中,如何搜索与正则表达式匹配的日志?

时间:2018-11-30 19:13:52

标签: sumologic

我正在尝试对与以下正则表达式匹配的日志进行Sumo Logic搜索:

"Authorization \d+ for story is not voided. Story not removed"

也就是说,\d+由一个或多个数字组成,但是它们到底是什么无关紧要。

基于搜索示例备忘单(https://help.sumologic.com/05Search/Search-Cheat-Sheets/General-Search-Examples-Cheat-Sheet),我尝试为此使用* | parse regex模式,但这不起作用:

enter image description here

我收到“在正则表达式中找不到捕获组”错误。我实际上对捕获数字并不真正感兴趣,只是匹配搜索中的正则表达式。我该如何实现?

1 个答案:

答案 0 :(得分:3)

我设法使其以两种方式工作。首先,使用常规parse代替parse regex

* | parse "Authorization * for story is not voided. Story not removed" as id |
count by _sourceHost | sort by _count

,或者在使用正则表达式时,它必须是一个命名组:

* | parse regex "Authorization (?<id>\d+) for story is not voided. Story not removed" |
count by _sourceHost | sort by _count
相关问题