<?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 How to use output of a 1st query as input in second query. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547840#M155354</link>
    <description>&lt;P&gt;I have a 1st query by taking input from the dashboard and where I got id as a result from that. And I want to use that id fetch from the 1st query , in my 2nd query as input and show the required fileds which is available in 2nd query on dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;N.B:- I know join but facing issue in how to pass that id as a variable to the 2nd query&lt;/P&gt;&lt;P&gt;Actually it need to be work on a dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Apr 2021 14:26:44 GMT</pubDate>
    <dc:creator>satyajit7</dc:creator>
    <dc:date>2021-04-14T14:26:44Z</dc:date>
    <item>
      <title>How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547840#M155354</link>
      <description>&lt;P&gt;I have a 1st query by taking input from the dashboard and where I got id as a result from that. And I want to use that id fetch from the 1st query , in my 2nd query as input and show the required fileds which is available in 2nd query on dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;N.B:- I know join but facing issue in how to pass that id as a variable to the 2nd query&lt;/P&gt;&lt;P&gt;Actually it need to be work on a dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 14:26:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547840#M155354</guid>
      <dc:creator>satyajit7</dc:creator>
      <dc:date>2021-04-14T14:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547842#M155356</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/233191"&gt;@satyajit7&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can use 1nd query as a subsearch or use map command. If you can share your sample queries, we can help to build the query.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 06:39:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547842#M155356</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-04-14T06:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547868#M155365</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&amp;nbsp; for the reply.&lt;/P&gt;&lt;P&gt;Mu sample query&lt;/P&gt;&lt;P&gt;1st query&lt;/P&gt;&lt;P&gt;...| rex "txnid".{5}(?&amp;lt;TXNID&amp;gt;.*?(?=\\\))"|dedup TXNID&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd query&amp;nbsp;&lt;/P&gt;&lt;P&gt;... Need to pass that TXNID here |&amp;nbsp;rex "custid".{5}(?&amp;lt;custid&amp;gt;.*?(?=\\\))"| rex "custname".{5}(?&amp;lt;custname&amp;gt;.*?(?=\\\))"|&amp;nbsp;rex "pdate".{5}(?&amp;lt;pdate&amp;gt;.*?(?=\\\))"|table custid, custname, pdate| rename custid as CustomerID, custname as Customer Name, pdate as Purchase Date&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NB:-&lt;/P&gt;&lt;P&gt;I will use this in the dashboard. In the dashboard I have one input text and a date filed which user need to provide. User will provide account id which need to be on 1st query based on the account and time stamo it will fetch the txnid and using that txnid need to fetch and show in the dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 10:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547868#M155365</guid>
      <dc:creator>satyajit7</dc:creator>
      <dc:date>2021-04-14T10:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547932#M155375</link>
      <description>&lt;P&gt;You can try below with only one search, subsearch output will be used as a filter for your second query. You can play with the token places according to your searches.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... | search [ search $token_account_id$ earliest=$token_time.earliest$ latest=$token_time.latest$| rex "txnid".{5}(?&amp;lt;TXNID&amp;gt;.*?(?=\\\))"|dedup TXNID | fields TXNID ] | rex "custid".{5}(?&amp;lt;custid&amp;gt;.*?(?=\\\))"| rex "custname".{5}(?&amp;lt;custname&amp;gt;.*?(?=\\\))"| rex "pdate".{5}(?&amp;lt;pdate&amp;gt;.*?(?=\\\))"|table custid, custname, pdate| rename custid as CustomerID, custname as Customer Name, pdate as Purchase Date &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 18:15:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547932#M155375</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-04-14T18:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547975#M155387</link>
      <description>&lt;P&gt;Thanks for your reply. I tried this subsearch approach but seems it didn't give me any results&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 05:41:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547975#M155387</guid>
      <dc:creator>satyajit7</dc:creator>
      <dc:date>2021-04-15T05:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547976#M155388</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&amp;nbsp;thanks so much. I just put join instead of | search and it worked magically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My final query will be like&amp;nbsp;&lt;/P&gt;&lt;P&gt;... | Join [ search $token_account_id$ earliest=$token_time.earliest$ latest=$token_time.latest$| rex "txnid".{5}(?&amp;lt;TXNID&amp;gt;.*?(?=\\\))"|dedup TXNID | fields TXNID ] | rex "custid".{5}(?&amp;lt;custid&amp;gt;.*?(?=\\\))"| rex "custname".{5}(?&amp;lt;custname&amp;gt;.*?(?=\\\))"| rex "pdate".{5}(?&amp;lt;pdate&amp;gt;.*?(?=\\\))"|table custid, custname, pdate| rename custid as CustomerID, custname as Customer Name, pdate as Purchase Date&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 05:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547976#M155388</guid>
      <dc:creator>satyajit7</dc:creator>
      <dc:date>2021-04-15T05:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547993#M155394</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;can you please help me. Still I'm facing issue to use the output of the 1st query in my 2nd query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And my 2nd query is complex one as it contains 3 join query but all 3 required txn id as input also&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 08:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/547993#M155394</guid>
      <dc:creator>satyajit7</dc:creator>
      <dc:date>2021-04-15T08:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use output of a 1st query as input in second query.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/548047#M155421</link>
      <description>&lt;P&gt;Hi, this is Burch. It looks like there is an accepted answer and others are already actively working with you on this. Is that not the case? If not, then perhaps un-accept the answer and let's make it clear that all are able to help you rather than specific people.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 16:40:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-output-of-a-1st-query-as-input-in-second-query/m-p/548047#M155421</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2021-04-15T16:40:34Z</dc:date>
    </item>
  </channel>
</rss>

