首页 > 解决方案 > Splunk:分配变量

问题描述

我在 splunk 中有一些数据,我试图为其创建仪表板。我不确定如何为要提取的 2 条数据分配变量名称。我的数据看起来像

From 5 new registrations, 4 emails were confirmed

我可以使用以下查询非常轻松地搜索此数据

search "From * new registrations, * emails were confirmed"

如何为每个星号分配一个变量?

谢谢!

标签: splunksplunk-query

解决方案


可能有几种方法可以做到这一点。我喜欢使用正则表达式和rex命令。

index=foo "From * new registrations, * emails were confirmed"
| rex "From (?<fromCount>\d+) new registrations, (?<emailCount>\d+) emails were confirmed"

推荐阅读