Splunk Enterprise Security

How do I build a search that compares 2 different indexes with 2 identical values?

itzikshviro
Explorer

Hi guys,

I need to build a search that compares 2 different indexes.

search 1 - index=indexname1 suser=username act=select
search 2 - index=indexname2 duser=username act=select

I need to compare the time stamp between the field values "suser" and "duser" (the value of "suser" and "duser" results in the same username).

Also, both indexes have the values "suser" and "duser", so it's kind of confusing.

I would like to display it on the same table.

Anyone knows how to accomplish that?

Your help would be highly appreciated.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

See if this helps.

(index=indexname1 suser=username act=select) OR (index=indexname2 duser=username act=select) 
| eval user=coalesce(suser, duser) 
| stats range(_time) by user
---
If this reply helps you, Karma would be appreciated.

ssadanala1
Contributor

Give it a shot

index=indexname1 | eval suser=user |table _time user act| eval first=_time |appendcols [ search index=indexname1 | eval duser=user | eval last=_time|table _time last act] | stats values(*) as * by user .

Please let know

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.


Introducing Unified TDIR with the New Enterprise Security 8.2

Read the blog

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...