Splunk 子搜索,使用主要搜索中字段的值来进行二次搜索

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

我需要从两个索引中提取信息,我需要使用第一个索引中搜索中的用户名,然后在第二个索引中搜索,以从不同的字段中提取该用户相应的电子邮件地址。我一直在尝试使用“搜索”和“加入”的不同方式,但无论我做什么都行不通。

index=dlp sourcetype="security:ta" signature="Administrative account was enabled"
| rename file_name as username
| join type=left username [search index=aad_enterprise userDisplayName=username | fields userPrincipalName | format | table userPrincipalName ]
| table _time user userPrincipalName

上面使用的是我第一次搜索中的“username”值,并用于匹配在“aad_enterprise”索引中进行的第二次搜索中的“userDisplayName”字段。我希望能够使用主搜索中第二次搜索的“userPrincipalName”字段中的值,因为这是用户的电子邮件,我需要将其列出,并在第一次搜索中提取更多信息。

我想做的事情可能吗?先谢谢你了

以下是我尝试过但没有成功的一些查询:

index=dlp sourcetype="security:ta" signature="Administrative account was enabled"
| rename file_name as username
| join type=left username [search index=aad_enterprise userDisplayName=username | fields userPrincipalName | format | table userPrincipalName ]
| table _time user userPrincipalName

index=dlp sourcetype="security:ta" signature="Administrative account was enabled"
 [search index=aad
enterprise userDisplayName=username
| fields userPrincipalName | rename userPrincipalName as userEmail]
| table _time username userPrincipalName

splunk splunk-query splunk-formula
1个回答
0
投票

第一个查询应该可以进行一些修改。不必费心尝试将 userDisplayName 与用户名匹配 -

join
就能做到这一点。

index=dlp sourcetype="security:ta" signature="Administrative account was enabled" 
| rename file_name as username 
| join type=left username [search index=aad_enterprise 
  | fields userPrincipalName 
  | rename userPrincipalName as username
  | format ] 
| table _time username

请注意,

join
命令的性能不是很好。

© www.soinside.com 2019 - 2024. All rights reserved.