<?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: Subserch - trying to use results from subsearch as an input on the main one. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466479#M131348</link>
    <description>&lt;P&gt;A subsearch should use the &lt;CODE&gt;fields&lt;/CODE&gt; command to specify which fields are to be passed back to the main search.  You may also need &lt;CODE&gt;format&lt;/CODE&gt; to put those fields into a format that is syntactically correct for the main search.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Apr 2020 13:49:33 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-04-03T13:49:33Z</dc:date>
    <item>
      <title>Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466478#M131347</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I  am trying to filter &lt;STRONG&gt;input&lt;/STRONG&gt; and &lt;STRONG&gt;output&lt;/STRONG&gt; with :&lt;BR /&gt;
2020-03-31 09:57:11,714 9.5.1455:  ERROR syslog156:  operation failed for (&lt;STRONG&gt;28, 325&lt;/STRONG&gt;). Status codes: 'blablabla'&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="main"   source="main.log"  ERROR syslog*
    | rex "(?=[\(](?&amp;lt;input&amp;gt;\d+)[,])"
    | rex "(?=[, ](?&amp;lt;output&amp;gt;\d+)[\).])"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and later find &lt;STRONG&gt;id&lt;/STRONG&gt; with (on log line input is separated from output with 'to')&lt;BR /&gt;
2020-03-31 09:57:11,020 9.5.1455: INFO syslog890: Should connect/disconnect &lt;STRONG&gt;28&lt;/STRONG&gt; to &lt;STRONG&gt;325&lt;/STRONG&gt; for 1.1.8.4.&lt;STRONG&gt;58&lt;/STRONG&gt;.1 with operation absolute&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="main"   source="main.log"  INFO syslog*  input "to" output
        | rex "(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.)(?&amp;lt;id&amp;gt;(\d{1,3}))"
        | table _time  id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the complete query looks like that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  host="main"   source="main.log"  INFO syslog* input "to" output
    | rex "(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.)(?&amp;lt;id&amp;gt;(\d{1,3}))"
    | table _time  id
    [search host="main"   source="main.log"  ERROR syslog*
    | rex "(?=[\(](?&amp;lt;input&amp;gt;\d+)[,])"
    | rex "(?=[, ](?&amp;lt;output&amp;gt;\d+)[\).])"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2020-03-31 09:57:11,020 9.5.1455: INFO syslog890: Should connect/disconnect 28 to 325 for 1.1.8.4.58.1 with operation absolute&lt;BR /&gt;
2020-03-31 09:57:11,714 9.5.1455:  ERROR syslog156:  operation failed for (28, 325). Status codes: 'blablabla'&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 12:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466478#M131347</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2020-04-03T12:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466479#M131348</link>
      <description>&lt;P&gt;A subsearch should use the &lt;CODE&gt;fields&lt;/CODE&gt; command to specify which fields are to be passed back to the main search.  You may also need &lt;CODE&gt;format&lt;/CODE&gt; to put those fields into a format that is syntactically correct for the main search.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 13:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466479#M131348</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-03T13:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466480#M131349</link>
      <description>&lt;P&gt;I have added | fields input, output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  host="main"   source="main.log"  INFO syslog* | fields input, output
     | rex "(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.)(?&amp;lt;id&amp;gt;(\d{1,3}))"
     | rex "(?:disconnect )(?&amp;lt;input_info&amp;gt;\d+)"
     | rex "(?:to )(?&amp;lt;output_info&amp;gt;\d+)"
     | table _time  id
     [search host="main"   source="main.log"  ERROR syslog*
     | rex "(?=[\(](?&amp;lt;input&amp;gt;\d+)[,])"
     | rex "(?=[, ](?&amp;lt;output&amp;gt;\d+)[\).])"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but still, it doesn't work as I expected. &lt;BR /&gt;
I would like to use results from first filtering and use it as a base on filtering on the second query. Something like: &lt;BR /&gt;
if  input==input_info AND output==output_info:&lt;BR /&gt;
   than: table _time  id&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:52:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466480#M131349</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2020-09-30T04:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466481#M131350</link>
      <description>&lt;P&gt;The &lt;CODE&gt;fields&lt;/CODE&gt; and &lt;CODE&gt;format&lt;/CODE&gt; commands should be in the subsearch (the one within &lt;CODE&gt;[]&lt;/CODE&gt;).  Subsearches execute before the main search.  The results of the subsearch then become part of the text of the main search.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 12:23:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466481#M131350</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-06T12:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466482#M131351</link>
      <description>&lt;P&gt;Sorry, I didn't catch, can you please rewrite my query with your fixes&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 13:20:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466482#M131351</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2020-04-06T13:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466483#M131352</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;host="main"   source="main.log"  INFO syslog* 
    [ search host="main"   source="main.log"  ERROR syslog*
      | rex "(?=[\(](?&amp;lt;input&amp;gt;\d+)[,])"
      | rex "(?=[, ](?&amp;lt;output&amp;gt;\d+)[\).])"
      | fields input, output | format ]
    | rex "(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.)(?&amp;lt;id&amp;gt;(\d{1,3}))"
    | rex "(?:disconnect )(?&amp;lt;input_info&amp;gt;\d+)"
    | rex "(?:to )(?&amp;lt;output_info&amp;gt;\d+)"
    | table _time  id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Apr 2020 12:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466483#M131352</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-08T12:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466484#M131353</link>
      <description>&lt;P&gt;Still doesn't work.&lt;BR /&gt;
Maybe I wasn't enough specific about my goal. &lt;BR /&gt;
From the subsearch I am receiving two ID's (input, output). I would like to use them as values to filter the main search and find id_mrp correlated with both: input and output.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 12:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466484#M131353</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2020-04-09T12:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Subserch - trying to use results from subsearch as an input on the main one.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466485#M131354</link>
      <description>&lt;P&gt;The subsearch is returning a search string in the form &lt;CODE&gt;(input=foo OR output=bar)&lt;/CODE&gt;.  Perhaps that is not the right format for your main search.  Let's try another method.  This is the general form for one way of combining two searches.  The problem is there is no common field between the two searches to use for grouping by the &lt;CODE&gt;stats&lt;/CODE&gt; command.  I'll let you find the common field and update the query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="main"   source="main.log"  INFO syslog* 
| rex "(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.)(?&amp;lt;id&amp;gt;(\d{1,3}))"
| rex "(?:disconnect )(?&amp;lt;input_info&amp;gt;\d+)"
| rex "(?:to )(?&amp;lt;output_info&amp;gt;\d+)"
| append [ search host="main"   source="main.log"  ERROR syslog*
       | rex "(?=[\(](?&amp;lt;input&amp;gt;\d+)[,])"
       | rex "(?=[, ](?&amp;lt;output&amp;gt;\d+)[\).])" ]
| stats values(*) as * by id
| table _time  id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Apr 2020 12:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subserch-trying-to-use-results-from-subsearch-as-an-input-on-the/m-p/466485#M131354</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-09T12:30:30Z</dc:date>
    </item>
  </channel>
</rss>

