Regex If语句和提取值

Regex If语句和提取值,regex,extract,splunk,splunk-query,Regex,Extract,Splunk,Splunk Query,我有一个结果集,看起来像 {add=[44961373 (1645499799657512961), 44961374 (1645499799658561538), 44962094 (1645499799659610114), 44962095 (1645499799659610117), 44962096 (1645499799660658689), 44962097 (1645499799660658691), 44962098 (1645499799661707264), 4496209

我有一个结果集,看起来像

{add=[44961373 (1645499799657512961), 44961374 (1645499799658561538), 44962094 (1645499799659610114), 44962095 (1645499799659610117), 44962096 (1645499799660658689), 44962097 (1645499799660658691), 44962098 (1645499799661707264), 44962099 (1645499799661707267), 44962100 (1645499799662755840), 44962101 (1645499799662755843), ... (592 adds)]}
如果add=[数组中有10个以上的元素,那么它将在语句末尾添加x adds,以显示实际有多少个add。如果它的元素少于10,那么它将不会添加x adds语句。我需要时间图表和单值输出,并将这些输出输出到仪表板单独的模块

我可以得到一个或另一个,但我想用逻辑来确定报告哪一个

index="index" host="host*" path=/update | eval count=mvcount(add) | stats count
将获取数组的计数

index="index" host="host*"  path=/update | stats sum(Adds)
将获取x adds的值。adds是一个“提取字段”

如何获取或?如果添加数组>10,请同时使用sumAdds

index="index" host="host*" path=/update | eval count=mvcount(add)
| eval first_ten="{add=[".mvjoin(mvindex(add,0,9), ",")." (" (count-10)." adds)}"
| eval msg=if(count<10,_raw,first_ten)
您可以这样做。获取添加的计数,创建一个仅包含前10个元素的新字符串,并在末尾添加count-10 adds消息。然后,根据实际计数,使用原始或新消息