Splunk Search

search same id from different source type and fieldname

diag
New Member

I have same requestid such req123 that belong to different field name( f1 and f2 ) from two sourcetype A and B

I would like to make SPL search like below , how to make it ?

sourceype=A OR sourcetype B | "if f1(requestid)=f2(requestid) | table requestid user city work team .....

Tags (1)
0 Karma

diag
New Member

I don;t know what's eval command I need to here but I like to make SPL like before

sourcetype A , field_a(requestid) field_a2 , field_a3 ,field_a4

sourcetype B, field_b(requestid) field_b2, field_b3, filed_b4

(what kind of eval or join i need to use here ) ?????

where field_a(requestid)=field_b(requestid)

table field_a(requestid) field_b(requestid) field_a3 ,field_a4 ,filed_b4

0 Karma

solarboyz1
Builder

Check out the coalesce function of eval

(sourcetype=A AND f1=) OR (sourcetype=B AMD f2=) | eval requestid=coalesce(f1,f2) | table requestid user city work team .....

0 Karma

solarboyz1
Builder

Corrected text of search:

(sourcetype=A AND f1=*) OR (sourcetype=B AMD f2=*) | eval requestid=coalesce(f1,f2) | table requestid user city work team ..... 
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!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...