Splunk Search

Search if field value appears in another search or not

smcdonald20
Path Finder

Trying to find any DeviceId field values that appear in the ActiveSync search but NOT in the MobileIron search.
What is the best way to do this?

ActiveSync search:
index=msexchange source=otl_activesyncinventory

|dedup SamAccountName, DeviceId

|table companyOu, SamAccountName, "AD Account Enabled", DeviceId

MobileIron search:
index=msexchange source=otl_mobileiron
| table, DeviceId, MailboxId, Status

Tags (2)
0 Karma
1 Solution

rjthibod
Champion

This will give you the list of DeviceId values that only appear in the ActiveSync search.

index=msexchange (source=otl_activesyncinventory OR source=otl_mobileiron)
| stats count by source DeviceId
| eventstats dc(source) as dc by DeviceId
| search dc=1 source=otl_activesyncinventory
| fields DeviceId

You can then use that search in the first step of you first search to get the full table of results you are looking for

index=msexchange source=otl_activesyncinventory 
[   
    search index=msexchange (source=otl_activesyncinventory OR source=otl_mobileiron)
    | stats count by source DeviceId
    | eventstats dc(source) as dc by DeviceId
    | search dc=1 source=otl_activesyncinventory
    | fields DeviceId
]
|dedup SamAccountName, DeviceId 
|table companyOu, SamAccountName, "AD Account Enabled", DeviceId

View solution in original post

0 Karma

rjthibod
Champion

This will give you the list of DeviceId values that only appear in the ActiveSync search.

index=msexchange (source=otl_activesyncinventory OR source=otl_mobileiron)
| stats count by source DeviceId
| eventstats dc(source) as dc by DeviceId
| search dc=1 source=otl_activesyncinventory
| fields DeviceId

You can then use that search in the first step of you first search to get the full table of results you are looking for

index=msexchange source=otl_activesyncinventory 
[   
    search index=msexchange (source=otl_activesyncinventory OR source=otl_mobileiron)
    | stats count by source DeviceId
    | eventstats dc(source) as dc by DeviceId
    | search dc=1 source=otl_activesyncinventory
    | fields DeviceId
]
|dedup SamAccountName, DeviceId 
|table companyOu, SamAccountName, "AD Account Enabled", DeviceId
0 Karma
Get Updates on the Splunk Community!

Infographic provides the TL;DR for the 2023 Splunk Career Impact Report

We’ve been shouting it from the rooftops! The findings from the 2023 Splunk Career Impact Report showing that ...

Splunk Lantern | Getting Started with Edge Processor, Machine Learning Toolkit ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...