Splunk Search

How do I pass the output of first search to the subsearch in the same index?

ruth091
New Member

I have an index="summary" where it captures both success connections and error connections.

I need to get the connection ID for those Error connections and with the output of this search (connection ID) need to subsearch in the same index to get the source IP.

CONNID value is the list. For each CONNID need to pass to the subsearch.

I used this query:

index=summary  sourcetype=ldap_log    eventtype=nix_errors | fields CONNID    | rename CONNID As cid |  map    search="search index=summary     sourcetype=ldap_log ID=$con_id$    src_ip"

It returns null value, but when i executed separately it works.

Tags (1)
0 Karma
1 Solution

Vijeta
Influencer

If you are running on dashboard XML, use $$ instead of $. Also you have renamed CONNID as cid, so that should be used in subserach instead of con_id.
If it is a string then needs to be escaped as, ID=\"$cid$\" , if on dashboard XML use ID=\"$$cid$$\"

View solution in original post

0 Karma

Vijeta
Influencer

If you are running on dashboard XML, use $$ instead of $. Also you have renamed CONNID as cid, so that should be used in subserach instead of con_id.
If it is a string then needs to be escaped as, ID=\"$cid$\" , if on dashboard XML use ID=\"$$cid$$\"

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...