Splunk Search

JOIN to list user per DeviceId

davidcraven02
Communicator

Search is trying to show all users within the companyOu that have Mobile Iron setup (Status=Allowed) and those that do not (Mobile Iron not setup)

The below search is only showing one user listed but some users have more than one DeviceId configured. I can't work out why all DeviceId's are not showing for a user.

index=ad source=aduserscan 
| table samAccountName, companyOu, displayName 
| search samAccountName=*_cp companyOu=dacp.com 
| rename samAccountName as MailboxId 
| join type=left MailboxId 
    [ search index=msexchange source=otl_mobileiron MailboxId=*_cp 
    | dedup DeviceId 
    | search Retired="false" ] 
| rename companyOu as Company, MailboxId as "User ID", DeviceFriendlyName as Model, displayName as "Display Name", SyncStatus as Status 
| fillnull value="Mobile Iron not setup" Status 
| table Company, "User ID", "Display Name", "Status" DeviceId
| sort Company asc

alt text

Tags (2)
0 Karma

niketn
Legend

@davidcraven02, Can you try the following:

index=msexchange source=otl_mobileiron MailboxId=*_cp Retired="false" 
| dedup MailboxId DeviceId 
| rename MailboxId as samAccountName 
| join type=left samAccountName 
    [ search index=ad source=aduserscan samAccountName=*_cp companyOu=dacp.com 
    | dedup samAccountName, companyOu, displayName ] 
| rename companyOu as Company, samAccountName as "User ID", DeviceFriendlyName as Model, displayName as "Display Name", SyncStatus as Status 
| fillnull value="Mobile Iron not setup" Status 
| table Company, "User ID", "Display Name", "Status" DeviceId 
| sort Company asc

If this does not work, can you share example of which record from specific index does not show up? Mock/Anonymize sensitive data.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

davidcraven02
Communicator

Thanks but this only returned 60 results whereas my original search returns 146 results.

I cant upload a screenshot but this search returned all users who have MobileIron (listing several DeviceId's per user) but it did not include those users who don't have it. The source aduserscan contains all users within the companyOu.

0 Karma

niketn
Legend

@davidcraven02 without having a look at some data values from events for the two sources, it would be difficult to come up with exact query, but can you try a different approach to check whether all Device IDs for various MailBoxIds show up

( index=msexchange source=otl_mobileiron MailboxId=*_cp Retired="false" ) OR (index=ad source=aduserscan samAccountName=*_cp companyOu=dacp.com)
| rename samAccountName as MailboxId 
| stats count values(DeviceId) as DeviceId by MailboxId
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

davidcraven02
Communicator

This returned 146 results which is the total number of users for this company. However each MailboxId has a count of 1 and no DeviceId is displayed.

MailboxId count DeviceId
Haver_cp 1

dadams_cp 1

Forindex=msexchange source=otl_mobileiron MailboxId=*_cp Retired="false" the user field is called MailboxId not samAccountName.

And the user field for index=ad source=aduserscanis called samAccountName

( index=msexchange source=otl_mobileiron MailboxId=*_cp Retired="false" )
      | stats count values(DeviceId) as DeviceId by MailboxId

When I search the above I get the below data

MailboxId   count   DeviceId
abon_cp          1         nine54011c5277ab
acavez_cp   1         ninebe03364cd694
acori_cp            1        iqj4udgc1h1q31j8vik9vceflo
akura_cp    1        rbmm3dea9d45v2kbt1rs36a7ok
aruma_cp    2        e53fd31687aa1ae3
                                     ninea8a1b3156df0
0 Karma

niketn
Legend

@davidcraven02, give the following a try, see whether matches for MailboxIds are coming from both sources otl_mobileiron and aduserscan or not.

( index=msexchange source=otl_mobileiron MailboxId=*_cp Retired="false" ) OR (index=ad source=aduserscan samAccountName=*_cp companyOu=dacp.com)
 | eval MailboxId=coalesce(MailboxId,samAccountName)
 | stats count values(source) as source  values(DeviceId) as DeviceId by MailboxId
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

mayurr98
Super Champion

can you try this?

index=ad source=aduserscan samAccountName=*_cp companyOu=dacp.com 
| stats count by samAccountName, companyOu, displayName 
| rename samAccountName as MailboxId 
| join type=left MailboxId 
    [ search index=msexchange source=otl_mobileiron MailboxId=*_cp Retired="false" 
    | dedup MailboxId DeviceId] 
| rename companyOu as Company, MailboxId as "User ID", DeviceFriendlyName as Model, displayName as "Display Name", SyncStatus as Status 
| fillnull value="Mobile Iron not setup" Status 
| table Company, "User ID", "Display Name", "Status" DeviceId 
| sort Company asc
0 Karma

davidcraven02
Communicator

Thanks but this is gives the same number of results only a more efficient way to run it.

0 Karma
Get Updates on the Splunk Community!

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...

Cloud Platform & Enterprise: Classic Dashboard Export Feature Deprecation

As of Splunk Cloud Platform 9.3.2408 and Splunk Enterprise 9.4, classic dashboard export features are now ...