<?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: pass variable and value to subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569873#M198624</link>
    <description>&lt;P&gt;Thanks @&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147" target="_self"&gt;&lt;SPAN class="login-bold"&gt;somesoni2.&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Can we have a quick webex and discussion on this ?&amp;nbsp; I am on this webex in another 1 hour from now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;A href="https://cisco.webex.com/meet/qingzhan" target="_blank" rel="noopener"&gt;Join Mywebex&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Oct 2021 12:52:20 GMT</pubDate>
    <dc:creator>Qingguo</dc:creator>
    <dc:date>2021-10-06T12:52:20Z</dc:date>
    <item>
      <title>pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568746#M198209</link>
      <description>&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Hi All&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;I have a question and need to do the following:&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;Search contidtion_1 from (index_1 ) and then get the value of field_1 and the value of field_2. &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;then search the value of field_1 from (index_2 )&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;and get value of field_3. &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;I want to have a difference calculation&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;between&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;value of field_2 and value of field_3.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;It it possible to&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;achieve this using a single query?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 14:24:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568746#M198209</guid>
      <dc:creator>Qingguo</dc:creator>
      <dc:date>2021-09-28T14:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568767#M198215</link>
      <description>&lt;P&gt;Do you mean a join between index1 and index2 using field1?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search index_1 ...
| join field_1 [search index_2 ...]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568767#M198215</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-28T15:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568775#M198217</link>
      <description>&lt;P&gt;This question is way too generic. It depends. Often you can avoid subsearch alltogether with clever data manipulation. But sometimes you can't and you need simple subsearch or even | map&lt;/P&gt;&lt;P&gt;Hard to say without knowing more details.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:36:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568775#M198217</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T15:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568778#M198219</link>
      <description>&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;Try something like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=index_1 sourcetype=sourcetypeHere contidtion_1 ) OR (index=index_2 sourcetype=sourcetypeHere contidtion_2 )

| fields field_1 field_2 field_3

| stats values(field_2) as field_2 values(field_3) as field_3 by field_1

| eval diff=field_2-field_3&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:43:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/568778#M198219</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-09-28T15:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569712#M198560</link>
      <description>&lt;P&gt;Thanks for your reply ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;here are more detailed requirement, I've got some logs I need to join and put on the same row and difference values .&lt;/P&gt;&lt;P&gt;Index1 events: (base query: index=index1 playbook=100)&lt;/P&gt;&lt;P&gt;"Playbook":"100","update_time":"2021-09-27T10:51:16.572759Z","container":"1497"&lt;BR /&gt;"Playbook":"100","update_time":"2021-09-27T10:52:16.572759Z","container":"1498"&lt;BR /&gt;"Playbook":"100","update_time":"2021-09-27T10:53:16.572759Z","container":"1499"&lt;BR /&gt;........&lt;/P&gt;&lt;P&gt;Index2 events (base query: index=index2 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;"container":"1497","start_time":"2021-09-26T8:53:16.232759Z"&lt;BR /&gt;"container":"1498","start_time":"2021-09-25T8:53:16.232759Z"&lt;BR /&gt;.....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Desired output:&lt;/P&gt;&lt;P&gt;container start_time update_time time_diff(update_time-start_time)&lt;BR /&gt;1497 2021-09-26T8:53:16.232759Z 2021-09-27T10:51:16.572759Z xxx&lt;BR /&gt;1498 2021-09-25T8:53:16.232759Z 2021-09-27T10:52:16.572759Z xxxx&lt;BR /&gt;1499 ....&lt;/P&gt;&lt;P&gt;Appreciated for any comments.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:01:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569712#M198560</guid>
      <dc:creator>Qingguo</dc:creator>
      <dc:date>2021-10-05T15:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569713#M198561</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=index1 playbook=100) OR (index=index2 ...)
| fields container update_time start_time
| stats values(start_time) as start_time values(update_time) as update_time by container
| eval time_diff=strptime(update_time,"%Y-%m-%dT%H:%M:%S.%6N%Z")-strptime(start_time,"%Y-%m-%dT%H:%M:%S.%6N%Z")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:08:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569713#M198561</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-10-05T15:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569718#M198562</link>
      <description>&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;Sorry&amp;nbsp; just one correction,&amp;nbsp; &amp;nbsp;field name of container in index1 is "container" and is renamed as "id" in index2 event log.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;Index2 events (base query: index=index2 ...)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"id":"1497","start_time":"2021-09-26T8:53:16.232759Z"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"id":"1498","start_time":"2021-09-25T8:53:16.232759Z"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:35:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569718#M198562</guid>
      <dc:creator>Qingguo</dc:creator>
      <dc:date>2021-10-05T15:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569731#M198566</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=index1 playbook=100) OR (index=index2 ...)
| fields id container update_time start_time
| eval container=coalesce(id, container)
| stats values(start_time) as start_time values(update_time) as update_time by container
| eval time_diff=strptime(update_time,"%Y-%m-%dT%H:%M:%S.%6N%Z")-strptime(start_time,"%Y-%m-%dT%H:%M:%S.%6N%Z")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Oct 2021 16:51:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569731#M198566</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-10-05T16:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569873#M198624</link>
      <description>&lt;P&gt;Thanks @&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147" target="_self"&gt;&lt;SPAN class="login-bold"&gt;somesoni2.&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Can we have a quick webex and discussion on this ?&amp;nbsp; I am on this webex in another 1 hour from now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;A href="https://cisco.webex.com/meet/qingzhan" target="_blank" rel="noopener"&gt;Join Mywebex&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 12:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569873#M198624</guid>
      <dc:creator>Qingguo</dc:creator>
      <dc:date>2021-10-06T12:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: pass variable and value to subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569903#M198637</link>
      <description>&lt;P&gt;Just one clarification,&amp;nbsp; "id" was being used in index1 for other meaning.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Testing your query , I cant get values of start_time in index2&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 14:31:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/pass-variable-and-value-to-subsearch/m-p/569903#M198637</guid>
      <dc:creator>Qingguo</dc:creator>
      <dc:date>2021-10-06T14:31:51Z</dc:date>
    </item>
  </channel>
</rss>

