Dashboards & Visualizations

Combine 2 events by a matching field without using join.

anooshac
Communicator

Hi all,

I have 2 events present in a source type, with different data. There is one field which has same data in both the events but the field names are different. Can anyone suggest a method other than JOIN to combine 2 events? I tried combining the fields by coalesce command, once i combine them i was not able to see the combined fields.

I want to combine the events and do some calculations.

Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @anooshac,

you have to coalesce the key fields and then correclate them using stats:

if the fields to correlate are field1 and field2 and the fields to display are field3 and field4 from the type1 and field5 from type2

index=your_index sourcetype=your_sourcetype type IN (type1, type2)
| eval key=coalesce(field1,field2)
| stats 
     values(field3) AS field3
     values(field4) AS field4
     values(field5) AS field5
     BY key

Cao.

Giuseppe

 

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @anooshac,

you have to coalesce the key fields and then correclate them using stats:

if the fields to correlate are field1 and field2 and the fields to display are field3 and field4 from the type1 and field5 from type2

index=your_index sourcetype=your_sourcetype type IN (type1, type2)
| eval key=coalesce(field1,field2)
| stats 
     values(field3) AS field3
     values(field4) AS field4
     values(field5) AS field5
     BY key

Cao.

Giuseppe

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @anooshac ,

good for you, see next time!

Ciao and happy splunking

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...