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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...