Splunk Search

How to Combine Events with matching data

BlueWombat45
New Member

Hi, I have a union'ed search where I am wanting to link different events based on fields that have matching values.
My search looks like this:
| union
[search message=*
| spath Field1
| spath Field2]
[search city=*
| spath FieldA 
| spath FieldB]
| table Field1 Field2 FieldA FieldB

My current output looks like this:

Field1Field2FieldAFieldB
JohnBlue  
  BlueOhio
  YellowWyoming

 

However I need a way to link Field1 to FieldB if Field2=FieldA, where the output would look something like this: 

Field1Field2FieldAFieldB
JohnBlueBlueOhio
  YellowWyoming


If there is a way to do something like this, please let me know, even if I need to create new fields. The excess FieldA and FieldB are unimportant if there is not a matching Field2. 

please help, please

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
message=* OR city=*
| eval Field2=coalesce(Field2, FieldA)
| stats values(*) as * by Field2
| where isnotnul(Field1)
0 Karma
Get Updates on the Splunk Community!

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...