Splunk Search

how to exclude the subsearch result from main search

ycho1
Explorer

hello,

Can anyone tell me how to exclude the subsearch result from main search?
I want to exclude the result that failed at 1st attempt, but later the person purchased successfully.

I only want to capture PURCHASEID(s) that failed and has not been able to purchase yet.

Here's my pseudo code that I am trying to accomplish

index=main sourcetype="access_combined_wcookie" AND ("*TIME_OUT*")
| rex field=_raw "\[(?<PURCHASEID>\d{12}\-\d{3})\]"
| search NOT [ search index=main sourcetype="access_combined_wcookie" AND ("*Successfully Ordered*")"
| rex field=_raw "\[(?<PURCHASEID>\d{12}\-\d{3})\]" | table PURCHASEID]
| table PURCHASEID, _raw
| dedup PURCHASEID
| sort +PURCHASEID

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

You could try it with subsearch and exclusion (you'd need to enclose the subsearch in parentheses though) but it will be highly inefficient. If you can corelate on a particular field (and I can see you want to use PURCHASEID for this), use either selfjoin, transaction or even simple stats to group your events.

0 Karma

ycho1
Explorer

Can you provide me a good example on how to write selfjoin or other solution with my intention if you are willing to help?

 

0 Karma

isoutamo
SplunkTrust
SplunkTrust

ycho1
Explorer

Is there any other suggestion?

I have not made much progress on this,  I was looking for some examples with selfjoin, transaction or stats commad, it won't go anywhere.

 

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 ...