<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Parameter passing between 2 searches as input as well as output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409978#M118262</link>
    <description>&lt;P&gt;You helped me already so please don't be sorry. I am not accepting it as of now because it might mislead someone in future. However, Once I solve this issue, I will write it in the comment and accept the answer. Thanks for the helping hand. &lt;/P&gt;</description>
    <pubDate>Wed, 27 Jun 2018 13:04:18 GMT</pubDate>
    <dc:creator>Chandras11</dc:creator>
    <dc:date>2018-06-27T13:04:18Z</dc:date>
    <item>
      <title>Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409971#M118255</link>
      <description>&lt;P&gt;HI All,&lt;/P&gt;

&lt;P&gt;I need to give input from search1 to search2 and then get a single result from search 2 with the values from search 1.&lt;BR /&gt;&lt;BR /&gt;
For example, in the tables below, the correct Main_Ticket for Z4563A/B/C/*  is C2995A. To find it, first I need just first 5 Character from the Sourcetype_B Ticket (Z4563), Then I need to pass it to another query, where I can search Z4563 in the Sourcetype_A linked tickets. If found, I need to return  Sourcetype_A Ticket as output(Here  C2995A). &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Sourcetype_A
 Ticket  |   Main_Ticket |  Value  | Line |   LinkedTicket
 A2345A    | A2345A   |     DES    |   L1       |
 C2995B001  | C2995B     |   DTS    |   X2       |
 C2995A    | C2995A     |   DPU    |   L1     |  Z4563A, C2995A001, C2995B001
 C2995A001 |  C2995A   |     DTS    |   X2    |

 Sourcetype_B
 Ticket    | Main_Ticket |    Value  | Line   | LinkedTicket
 A2345A002  | A2345A    |    DES    |   L1    |   
 C2995B002  | C2995B     |   DTS    |   X2      | 
 C2995A003  | C2995A      |  DPU     |  L1       |
 Z4563B     | Z4563A    |    SUB  |    S1    | Z4563A Z4563C 
 Z4563A   |   Z4563A   |     SUB     |  S1   | Z4563B Z4563C
 Z4563C  |   Z4563A     |   SUB    |   S1   |  Z4563A Z4563B
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First I tried with eval and subquery as: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Index_Source" sourcetype="Sourcetype_B" SUB | rename Ticket as B_Ticket | 
eval Main_Ticekt_5=substr(B_Ticket,1,5) | table  Main_Ticekt_5 | 
eval B_MAIN_TIcket = [ search sourcetype="Sourcetype_A" | rename Ticket as A_Ticket | 
 rename LinkedTicket as A_LinkedTicket | search( A_LinkedTicket=*$Main_Ticekt_5$*) |
 eval B_SUB_MAINTICKET="\"$A_Ticket$\"" | 
 return $B_SUB_MAINTICKET ] | table B_Ticket, B_SUB_MAINTICKET
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, It is not working. I read online that it is not possible to pass variables in eval search. Is there any other possible way to do it. &lt;BR /&gt;
Just a quick note: In such a situation, is it better to use left join or map search? The data given here is a dummy but in real life, I have 10k+ events, where I need to calculate the B_SUB_MAINTICKET. &lt;BR /&gt;
My apologies for such a long post. Thanks a lot in advance for your help. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:12:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409971#M118255</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2020-09-29T20:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409972#M118256</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I don't really know how to use &lt;CODE&gt;map&lt;/CODE&gt; so I will try to provide you a working query with a &lt;CODE&gt;join&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Index_Source" sourcetype="Sourcetype_B" SUB 
| rename Ticket as B_Ticket 
| eval Main_Ticket_5=substr(B_Ticket,1,5) 
| table Main_Ticket_5 
| join Main_Ticket_5 
    [ search index="Index_Source" sourcetype="Sourcetype_A" 
    | rename Ticket as A_Ticket 
    | eval Main_Ticket_5 = split(LinkedTicket,",") 
    | mvexpand Main_Ticket_5 
    | table Main_Ticket_5,A_Ticket]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tell me if it works (hope there is not too much error, I have nothing to test it :p)&lt;BR /&gt;
Also, just remember than a sub-search can produce up to 50 000 events.&lt;/P&gt;

&lt;P&gt;Kail&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 23:28:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409972#M118256</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2018-06-26T23:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409973#M118257</link>
      <description>&lt;P&gt;Thanks a lot, let me check it... I just need the first one so I can use the | head 1 | command &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 06:34:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409973#M118257</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-06-27T06:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409974#M118258</link>
      <description>&lt;P&gt;If it works for you with the &lt;CODE&gt;|head 1&lt;/CODE&gt;, mark the answer as accepted !&lt;BR /&gt;
Instead, just tell me what's going on, I will try to help you again.&lt;/P&gt;

&lt;P&gt;Kail&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 12:38:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409974#M118258</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2018-06-27T12:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409975#M118259</link>
      <description>&lt;P&gt;Hi, Sorry for delay but it didnot work at my end. The problem is where are you cheking if Main_Ticket_5  is a substring of LinkedTicket. I need to find the A_Ticket  where Main_Ticket_5  is a substring of LinkedTicket. &lt;BR /&gt;
I was thinking if we can check substring Main_Ticket_5 in Linked ticket. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409975#M118259</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2020-09-29T20:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409976#M118260</link>
      <description>&lt;P&gt;Its just showing me: no result found.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 12:48:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409976#M118260</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-06-27T12:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409977#M118261</link>
      <description>&lt;P&gt;Ok I'm sorry I cannot check now, I will try to take a look later today for you.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 13:00:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409977#M118261</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2018-06-27T13:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter passing between 2 searches as input as well as output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409978#M118262</link>
      <description>&lt;P&gt;You helped me already so please don't be sorry. I am not accepting it as of now because it might mislead someone in future. However, Once I solve this issue, I will write it in the comment and accept the answer. Thanks for the helping hand. &lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 13:04:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parameter-passing-between-2-searches-as-input-as-well-as-output/m-p/409978#M118262</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-06-27T13:04:18Z</dc:date>
    </item>
  </channel>
</rss>

