Splunk Search

How to compare two fields in two different sourcetypes ?

chimbudp
Contributor

How to compare two fields in two different sourcetypes ?

eg:

Events from sourcetype 1 : int

Tier OS      version
SIT  MAC        v8 
SIT  Windows  v7    
SIT  CentOS     v2  

sourcetype 2 : uat

Tier OS      version   
UAT   MAC        v8 
UAT   Windows  v6    
UAT   CentOS     v2    

I used the query :

index=* sourcetype =int|table OS,INTversion|join[search index=* sourcetype=uat|table UATversion]

Output:

Tier | INTversion |UATversion
MAC | v8 | v8
Windows |v7 | v6 
CentOS | v2 |v2

I need a additional column here like Difference between INT & UAT -

Expected Output:

Tier | INTversion |UATversion | Difference
MAC | v8 | v8 | No
Windows |v7 | v6 |Yes
CentOS | v2 |v2 | No

I tried with some diff , match , eval commands - doesn't helped. Please help in this

Tags (4)
0 Karma

Ayn
Legend

What did you try that didn't work? I expect something like this should do it:

index=* sourcetype =int|table OS,INTversion|join[search index=* sourcetype=uat|table UATversion] | eval Difference=if(INTversion==UATversion,"No","Yes")
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...