我们如何编写Splunk查询来查找subField2是否存在,如果存在,则获取所有subFiled2的计数



{index:"myIndex",field1:"myfield1",field2:{"subField1":"mySubField1","subField2":145,"subField3":500},。。。。。。}

SPL:index:"myIndex"eval result=if(field.subField2(。。。。。点运算符在SPL中工作吗?

我假设您的数据是JSON格式的。如果是,则可以使用spath从结构化数据中提取字段。然后用isnotnull检查字段是否存在

index="myIndex" | spath | where isnotnull(field2.subField2)

假设您的数据是JSON格式的,那么应该这样做:

index=myIndex sourcetype=srctp field2{}.subField2=*

如果这些是多值字段,则需要首先进行mvexpand

最新更新