You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Splunk技术问询:找出仅关联event_A未关联event_B的ID

筛选仅关联event_A的ID(Splunk查询方案)

需求

从包含event_A和event_B的日志数据中,找出仅出现在event_A_recipients数组、从未在event_B_recipients里出现的ID,预期结果为id4。

可行的Splunk查询语句

index=<你的索引名称> eventType=event_A
| spath output=id path=event_A.event_A_recipients{}
| eval in_event_A=1
| append [
    index=<你的索引名称> eventType=event_B
    | spath output=id path=event_B.event_B_recipients{}
    | eval in_event_B=1
]
| stats max(in_event_A) as in_event_A max(in_event_B) as in_event_B by id
| where in_event_A=1 AND isnull(in_event_B)
| table id

逻辑说明

  • 用spath的path=xxx{}语法解析JSON数组,将数组内的每个ID拆分为单独数据行,便于后续统计
  • 通过append子搜索合并两类事件的ID数据集
  • 借助stats按ID分组,标记每个ID在两类事件中的存在状态
  • 最后通过where筛选出仅在event_A中出现、未在event_B中出现的ID

内容的提问来源于stack exchange,提问作者Fulliautomatix

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 20:04:57