<?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: How could we  use one search results in another search using subsearch query? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315244#M160040</link>
    <description>&lt;P&gt;@cmerriman &lt;BR /&gt;
I want to filter out those results which are not starting from "WF-".&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jul 2017 12:17:08 GMT</pubDate>
    <dc:creator>pinpra</dc:creator>
    <dc:date>2017-07-18T12:17:08Z</dc:date>
    <item>
      <title>How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315242#M160038</link>
      <description>&lt;P&gt;Query : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="heroku_secure_uat" host="messaging-service-uat.herokuapp.com" [search event_name=email OR event |where NOT LIKE(person_id,"%WF%")| stats dc(person_id)]| rex "(?\{.*)" | spath input=json_data
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result : &lt;/P&gt;

&lt;P&gt;172cd733-beec-490f-8f53-dbe68166bb33&lt;BR /&gt;
3874287d5dfb468187f5a42251214d15&lt;BR /&gt;
40c5778a-152c-40db-bf85-24c8aec427de&lt;BR /&gt;
5678c76c-e689-4712-a8fb-85e5e0c5097f&lt;BR /&gt;
618bd8ea-59dc-485f-a0a3-908adb804443&lt;BR /&gt;
6618bb54-73fd-4d13-b2e2-72e18171a904&lt;BR /&gt;
6f196d9397a64b0cb62196efd1d82309&lt;BR /&gt;
724ad888-cbd4-483f-91b3-01a95809ad7b&lt;BR /&gt;
9bd90012-f4e8-4bc2-b149-d63219aab343&lt;BR /&gt;
9e9f0ec6-899e-43a8-b1e3-ca158516b6fe&lt;BR /&gt;
WF-172cd733-beec-490f-8f53-dbe68166bb33\u0026token=-YIg4amu7FD76T2XGfd2-w&lt;BR /&gt;
WF-5678c76c-e689-4712-a8fb-85e5e0c5097f\u0026token=CycW6z87l5wFBjPlSQ2anQ&lt;BR /&gt;
WF-5678c76c-e689-4712-a8fb-85e5e0c5097f\u0026token=fqlqHuY284bpCU180o3jLw&lt;BR /&gt;
WF-5678c76c-e689-4712-a8fb-85e5e0c5097f\u0026token=hDLTqEqQwAabP5bXaqajJA&lt;BR /&gt;
WF-5678c76c-e689-4712-a8fb-85e5e0c5097f\u0026token=jU7sWgFiyNJ6DeYFp5kkhA&lt;BR /&gt;
WF-5678c76c-e689-4712-a8fb-85e5e0c5097f\u0026token=ta-NduNrMOUGqjbPUMbACA&lt;BR /&gt;
WF-bdd32edb-7ec0-43ca-9457-2fe6f74c294a\u0026token=aE1qDEBT0AE0tneHlyHecA&lt;BR /&gt;
b800274d-d134-48d9-973f-0c9361a615a6&lt;BR /&gt;
bdd32edb-7ec0-43ca-9457-2fe6f74c294a&lt;/P&gt;

&lt;P&gt;I need to use this above result again in same query to get those records count which are not starting with "WF-". &lt;/P&gt;

&lt;P&gt;Please suggest . &lt;/P&gt;

&lt;P&gt;Any help will be appreciated. &lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 11:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315242#M160038</guid>
      <dc:creator>pinpra</dc:creator>
      <dc:date>2017-07-18T11:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315243#M160039</link>
      <description>&lt;P&gt;so you want to add these results into a subquery or you want to filter out the WF- results and add the others to the subquery? what are you adding the subquery to? you can just add |format to the end of your query above and encase the whole search in square brackets and it will format it how you need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=newIndex [search index="heroku_secure_uat" host="messaging-service-uat.herokuapp.com" [search event_name=email OR event |where NOT LIKE(person_id,"%=%")| stats dc(person_id)]| rex "(?{.*)" | spath input=json_data|format]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jul 2017 11:39:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315243#M160039</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-07-18T11:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315244#M160040</link>
      <description>&lt;P&gt;@cmerriman &lt;BR /&gt;
I want to filter out those results which are not starting from "WF-".&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 12:17:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315244#M160040</guid>
      <dc:creator>pinpra</dc:creator>
      <dc:date>2017-07-18T12:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315245#M160041</link>
      <description>&lt;P&gt;@cmerriman &lt;BR /&gt;
When I run your query . It gives below error: &lt;/P&gt;

&lt;P&gt;Error in 'rex' command: Encountered the following error while compiling the regex '(?{.*)': Regex: unrecognized character after (? or (?-&lt;/P&gt;

&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 12:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315245#M160041</guid>
      <dc:creator>pinpra</dc:creator>
      <dc:date>2017-07-18T12:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315246#M160042</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search
| where NOT like(YourFieldName,"WF-%")
| stats count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jul 2017 14:21:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315246#M160042</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-07-18T14:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315247#M160043</link>
      <description>&lt;P&gt;@somesoni2&lt;BR /&gt;
I have updated my post.&lt;/P&gt;

&lt;P&gt;I have got above result by executing posted query and now I need to filter those records which are not starting with "WF-". &lt;/P&gt;

&lt;P&gt;It should be like subquery but not sure how to do this.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 17:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315247#M160043</guid>
      <dc:creator>pinpra</dc:creator>
      <dc:date>2017-07-18T17:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315248#M160044</link>
      <description>&lt;P&gt;If you just want to filter records which do not start with "WF-" (assuming that's a field whose value is used for filtering), then you can just include the where clause from my answer. Be sure to update the YourFieldName with actual field name.  Since you're filtering within same resultset, you don't need a subsearch. If this is not the case may be explain more, may be some sudo code depicting your requirement.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 18:33:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315248#M160044</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-07-18T18:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: How could we  use one search results in another search using subsearch query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315249#M160045</link>
      <description>&lt;P&gt;It's not a subquery, it's just a simple filter on your existing results.  somesoni2 gave you one way.  You would just add those last two lines on the end of your query, changing &lt;CODE&gt;YourFieldName&lt;/CODE&gt; to match the actual field name.&lt;/P&gt;

&lt;P&gt;One thing - please mark your code when you post it, for instance  with the code button 101 010, so that the interface will not strip out html-like parts of your code.  &lt;/P&gt;

&lt;P&gt;However, I really don't believe that code got that result.  It should be more like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="heroku_secure_uat" host="messaging-service-uat.herokuapp.com" 
 event_name=email OR event  
 | rex "(?&amp;lt;json_data&amp;gt;{.*)"
 | spath input=json_data
 | where NOT like(person_id,"%WF%")
 | table person_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...and there's something vaguely wrong with the second line  &lt;CODE&gt;event_name=email OR event&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 20:55:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-we-use-one-search-results-in-another-search-using/m-p/315249#M160045</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-18T20:55:55Z</dc:date>
    </item>
  </channel>
</rss>

