Splunk查询根据相同索引中的其他事件过滤掉

问题描述 投票:1回答:2

我有一个名为Events的索引

它包含许多不同的事件,所有事件都有一个称为EventName的属性。现在,我想执行一个查询,返回与以下内容匹配的所有内容:

如果事件名称为AccountCreated的事件中存在AccountId,并且事件名称为FavoriteCreated的至少一个事件具有相同的帐户ID->返回事件名称== AccountCreated的所有事件>

示例事件:

AccountCreated

{
   "AccountId": 1234,
   "EventName": "AccountCreated",
   "SomeOtherProperty": "Some value"
}

FavoriteCreated

{
   "AccountId": 1234,
   "EventName": "FavoritesCreated
}

鉴于以下两个事件,我想创建1个返回AccountCreated事件的查询。

我尝试了以下操作,但是它不起作用,肯定会丢失一些简单的内容吗?

index=events EventName=AccountCreated 
  [search index=events EventName=FavoriteCreated | dedup AccountId | fields AccountId]
| table AccountId, SomeOtherProperty

我预计这里会有〜6000次点击,但我只获得2298次活动。我想念什么?

我有一个名为Events的索引,它包含许多不同的事件,所有事件都有一个名为EventName的属性。现在,我想执行一个查询,返回与以下内容匹配的所有内容:IF ...

splunk splunk-query
2个回答
1
投票

[您也许发现了one factor个问题-subsearches的上限是50,000(执行join时))事件(或60秒的运行时间(或当您使用“常规”子搜索))。

[以10,000优先转储dedup


0
投票
事实证明,如果子搜索结果大于1万个,则Splunk会将其截断...index=events EventName=AccountCreated AccountId=* | stats count by AccountId, SomeOtherProperty [, more, fields, as, desired] | fields - count | join AccountId [ | search index=events EventName=FavoriteCreated AccountId=* | stats count by AccountId ] | fields - count <rest of search> Splunk search feedback
© www.soinside.com 2019 - 2024. All rights reserved.