Splunk Search

How do you display the values that are present in field A but not in Field B(Uncommon field values)?

pavanae
Builder

I have a query which gives the results as follows

April May June July
A G G K
B A H L
C B I I

Now, how do I get the values that are present in April but not in May and vice versa?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@pavanae

Can you please try this?

YOUR_SEARCH | eval N=1 
| accum N 
| eventstats values(May) as May_All values(April) as April_All 
| eval April_in=mvfind(May_All,April), May_in=mvfind(April_All,May) | where (isnull(April_in) OR isnull(May_in)) | table April May June July

Sample Search:

| makeresults 
| eval April="A",May="G",June="G",July="K" 
| append 
    [| makeresults 
    | eval April="B",May="A",June="H",July="L" ] 
| append 
    [| makeresults 
    | eval April="C",May="B",June="I",July="I" ] 
| eval N=1 
| accum N 
| eventstats values(May) as May_All values(April) as April_All 
| eval April_in=mvfind(May_All,April), May_in=mvfind(April_All,May) | where (isnull(April_in) OR isnull(May_in)) | table April May June July

Thanks

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...