Splunk Search

When I run a search by itself, it works fine, but when I run it as a subsearch, why is the resulting table empty?

mcgi906
Explorer
index=a | eval SPLITid=[search index=b | eval tempid= substr(SPLITLOTID,2,8) | return $tempid ] | table SPLITid

When I run the search by itself, it works fine, but when I run it as a subsearch the table is empty. Any ideas as to why?

0 Karma

mohebtalukder
New Member

Below search works:

index=_* | eval SPLITid=[search index=_audit | eval tempid=substr(id,2,5) | return $tempid] | table SPLITid

But next one did not work for me when I changed the field name:

index=_* | eval SPLITid=[search index=_audit | eval tempid=substr(source,2,5) | return $tempid] | table SPLITid

So, I will suggest you to lookinto substr command. Put it in between " " like below:

"substr(source,2,3)"

Working search:

index=_* | eval SPLITid=[ search index=_audit | eval tempid="substr(source,2,3)" | return $tempid] | table SPLITid

I hope you will find it helpful!!

0 Karma

somesoni2
Revered Legend

Give this a try

index=a | eval SPLITid=[search index=b | eval search= "\"".substr(SPLITLOTID,2,8)."\"" | return search ] | table SPLITid
0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...