首页 > 解决方案 > [splunk]: Obtain a count of hits in a query of regexes

问题描述

I am searching for a list of regexes in a splunk alert like this:

... | regex "regex1|regex2|...|regexn"

Can I modify this query to get a table of the regexes found along with their count. The table shouldn't show rows with 0 counts.

regex2 17
regexn 3

标签: devopssplunk

解决方案


regex命令仅过滤事件。我们所知道的是每个结果都通过了正则表达式。没有任何事件发生的原因或方式的记录或指示。

为此,您必须从每个正则表达式中提取一个唯一字段或值,然后测试结果事件以查看存在哪个字段或值。但是,该regex命令不会提取任何内容。你需要rex命令或match函数来做到这一点。


推荐阅读