devops - [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
解决方案
该regex
命令仅过滤事件。我们所知道的是每个结果都通过了正则表达式。没有任何事件发生的原因或方式的记录或指示。
为此,您必须从每个正则表达式中提取一个唯一字段或值,然后测试结果事件以查看存在哪个字段或值。但是,该regex
命令不会提取任何内容。你需要rex
命令或match
函数来做到这一点。
推荐阅读
- selenium - 量角器/硒获取元素的文本
- android - 如何为活动根视图设置布局重力
- javascript - 如何以随机顺序显示对象中的项目并保留它们各自的属性
- html - @font-face 没有加载字体?
- javascript - 网页视图内的 Phaser 3
- networking - F5 负载均衡器上的自 IP 列表中的 IP 地址之后的 % 100 有什么作用
- node.js - Heroku 卡在“构建中”
- api - 如何通过证书而不是休息请求?
- node.js - 从 hapi 16 迁移到 17 时,server.on 不是函数
- c# - 转置表示为 ulong 值的 4x4 矩阵(尽可能快)