Splunk Search

Filtering fields using a common field in two different sourcetypes

infotork
Explorer

fields in sourcetype1 --> A,B,C, txid ( always has a value)

fields in sourcetype2--> D,E,F, txid ( may occur value for some sources or may not)

Its clear that i have a common field ( txid) in two different sourcetypes  sourcetype1 and sourcetype2

Requirement:

I need to print  A,B from sourcetype1, in case i didnt find "txid" in  sourcetype2,  

Please help

Labels (5)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

How about

sourcetype=sourcetype1 OR sourcetype=sourcetype2
| stats values(A) as A values(B) as B values(sourcetype) as types by txid
| where mvcount(types)==1 AND isnull(mvfind(types,"sourcetype2"))
| table A B txid

 

0 Karma
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...