All Apps and Add-ons

How to achieve the result of the Datset - Minus query like

archestain
Explorer

Query A/Dataset A

sourcetype=aws_cloudtrail eventtime > "2021-01-01T00:00:00Z" AND eventtime < "2021-01-31T23:59:59Z" | stats values(eventnames) by accesskeyid

 

output:

accesskeyid.  values(eventnames)

ABCD.                  ListTopic CreateTopic

EFGH.                  CreateStream

 

Query B/Dataset B

sourcetype=aws_cloudtrail eventtime > "2021-04-01T00:00:00Z" AND eventtime < "2021-04-28T23:59:59Z" | stats values(eventnames) by accesskeyid

 

output:

accesskeyid.  values(eventnames)

ABCD             ListTopic ListBuckets Createtopic

EFGH.             CreateStream DeleteStream

DEF.                ListTickets

 

Ask:

Please provide a query where i need the output like below where only the unique values of eventnames from datasetB group by acesskeyid should be listed out when i run both the queries at the same search

 

output:

accesskeyid.  values(eventnames)

ABCD             ListBuckets

EFGH.             DeleteStream

DEF.                ListTickets

 

Thanks inn advance

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
sourcetype=aws_cloudtrail (eventtime > "2021-01-01T00:00:00Z" AND eventtime < "2021-01-31T23:59:59Z") OR (eventtime > "2021-04-01T00:00:00Z" AND eventtime < "2021-04-28T23:59:59Z")
| eval eventnamesA=if(eventtime > "2021-01-01T00:00:00Z" AND eventtime < "2021-01-31T23:59:59Z",eventnames,null)
| eventstats values(eventnamesA) as eventnamesA by accesskeyid
| eval eventnames=if(isnull(mvfind(eventnamesA,eventnames)),eventnames,null)
| stats values(eventnames) by accesskeyid

View solution in original post

archestain
Explorer

My bad, i mentioned the timelines wrong its the following eventtime > "2021-01-01T00:00:00Z" AND eventtime < "2021-03-31T23:59:59Z"

Ran the query but it does not fetch the expected result 😞

 

archestain_1-1620028053642.png

 

 

 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I assume eventnames is already extracted as a field? Can you share some anonymised events?

0 Karma

archestain
Explorer

The field is not eventnames but eventname, my bad i executed with eventnames

 

Thanks ITWhisperer for your help

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
sourcetype=aws_cloudtrail (eventtime > "2021-01-01T00:00:00Z" AND eventtime < "2021-01-31T23:59:59Z") OR (eventtime > "2021-04-01T00:00:00Z" AND eventtime < "2021-04-28T23:59:59Z")
| eval eventnamesA=if(eventtime > "2021-01-01T00:00:00Z" AND eventtime < "2021-01-31T23:59:59Z",eventnames,null)
| eventstats values(eventnamesA) as eventnamesA by accesskeyid
| eval eventnames=if(isnull(mvfind(eventnamesA,eventnames)),eventnames,null)
| stats values(eventnames) by accesskeyid
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...