Splunk Search

How to search by variable created within a join query?

akonduru
New Member

I want join/combine two searches by their common value to compare transaction success/failure rate at both places. i tried something below, but unable to search by evaluated result

Step1: Extract substring from second log as this value exactly doesn't match within first log.

index=indexoffirstlog sourcetype="secondlog" eval length=len(fieldinterestedin) | eval transaction_id=substr(fieldinterestedin, 6, length)

Step2: Search results within first log where result contain transaction_id (Not Joined yet, just checking first log query alone)

index=indexoffsfirstlog sourcetype="firstlog" matchstringoffirstlog

Step3: Now join both searches and search by transaction_id

index=indexoffirstlog AND index=indexofsecondlog sourcetype="secondlog" matchstringoffirstlog | eval length=len(fieldinterestedin) | eval result=substr(fieldinterestedin, 6, length) | search result

But i am not getting any results. appreciate any advice.

Tags (1)
0 Karma

woodcock
Esteemed Legend

Change your AND to OR!

0 Karma

somesoni2
Revered Legend

Is the length of fieldinterestedin constant?

0 Karma

akonduru
New Member

No, It is not same. length varies. But fieldinterestedin always start wit constant like "ABCD23423fsdfsd" where ABCD is constant.

0 Karma

somesoni2
Revered Legend

Final doubt, if you remove the constant part in the fieldinterestedin field from search 2, would it match exactly with fieldinterestedin in search 1?

0 Karma

akonduru
New Member

yes, it match except the constant part which is why i am doing substring to take off Constant part.

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...