<?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: Splunk Subquery in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/525922#M148430</link>
    <description>&lt;P&gt;Is there a specifics source type the the first one can be referenced against?&lt;BR /&gt;&lt;BR /&gt;I find the following approach to work best:&amp;nbsp; I write two independent searches&amp;nbsp; to bring the datasets we want.&lt;BR /&gt;&lt;BR /&gt;Write a search to do an OR statement&amp;nbsp; &amp;nbsp;((Search1 ) OR (Search2 )) pipe to stats&amp;nbsp; I have done counts against matches on sourcetype.&amp;nbsp; In your example I don't know if the first search as an exact sourcetype.&amp;nbsp; I did example stating "firstsourcetype" as a variable to replace twice in the search with the actual sourcetype to be used:&lt;BR /&gt;&lt;BR /&gt;The following search is intended to search both searches and then | stats (count matches by sourcetype or no by clause as necessary based on objective, then do the eval then table&lt;BR /&gt;&lt;BR /&gt;( sourcetype="firstsourcetype" "Carrier Failure: provider_name=*" ) OR&lt;BR /&gt;( sourcetype="supervisor" host="prod-celery-gateway-0*" "driver dispatch_request: Sending request to" NOT failed )&lt;BR /&gt;| stats count(eval(LIKE(sourcetype,"firstsourcetype"))) as total_carrier_errors, count(eval(LIKE(sourcetype,"supervisor"))) as total_requests&lt;BR /&gt;| eval carrier_errors_percent=(total_carrier_errors/total_requests*100)&lt;BR /&gt;| table total_carrier_errors total_requests&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2020 22:25:56 GMT</pubDate>
    <dc:creator>kennetkline</dc:creator>
    <dc:date>2020-10-21T22:25:56Z</dc:date>
    <item>
      <title>Splunk Subquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/524727#M148017</link>
      <description>&lt;DIV&gt;Basically, I have a problem in which I want to run two queries the first query will return me the total number of requests and the second query will return requests that fail so that i can calculate the percentage but I am unable to do this with a subquery.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Currently, I am using this query&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;"Carrier Failure: provider_name=*" &lt;BR /&gt;| dedup application_id | stats count AS total_carrier_errors &lt;BR /&gt;| append &lt;BR /&gt;[search host="prod-celery-gateway-0*" sourcetype="supervisor" &lt;BR /&gt;"driver dispatch_request: Sending request to" NOT failed &lt;BR /&gt;| stats count AS total_requests] &lt;BR /&gt;| table total_carrier_errors total_requests &lt;BR /&gt;| eval carrier_errors_percent=(total_carrier_errors/total_requests*100)&lt;/PRE&gt;&lt;P&gt;Can anyone guide me with this?&lt;BR /&gt;&lt;BR /&gt;Thank You!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 20:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/524727#M148017</guid>
      <dc:creator>haiderzada</dc:creator>
      <dc:date>2020-10-14T20:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Subquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/524730#M148018</link>
      <description>Could this helps you &lt;A href="https://community.splunk.com/t5/Splunk-Search/Finding-a-percentage-for-every-value-in-another-field/m-p/308390" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/Finding-a-percentage-for-every-value-in-another-field/m-p/308390&lt;/A&gt; ?</description>
      <pubDate>Wed, 14 Oct 2020 21:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/524730#M148018</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-10-14T21:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Subquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/524731#M148019</link>
      <description>&lt;P&gt;No this will not help me. Actually, my problem is different from this one I want to run two separate queries one will return me the total number of requests and the second query will return me the number of the failed requests and then I want to calculate the percentage based on these two returned values.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 21:13:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/524731#M148019</guid>
      <dc:creator>haiderzada</dc:creator>
      <dc:date>2020-10-14T21:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Subquery</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/525922#M148430</link>
      <description>&lt;P&gt;Is there a specifics source type the the first one can be referenced against?&lt;BR /&gt;&lt;BR /&gt;I find the following approach to work best:&amp;nbsp; I write two independent searches&amp;nbsp; to bring the datasets we want.&lt;BR /&gt;&lt;BR /&gt;Write a search to do an OR statement&amp;nbsp; &amp;nbsp;((Search1 ) OR (Search2 )) pipe to stats&amp;nbsp; I have done counts against matches on sourcetype.&amp;nbsp; In your example I don't know if the first search as an exact sourcetype.&amp;nbsp; I did example stating "firstsourcetype" as a variable to replace twice in the search with the actual sourcetype to be used:&lt;BR /&gt;&lt;BR /&gt;The following search is intended to search both searches and then | stats (count matches by sourcetype or no by clause as necessary based on objective, then do the eval then table&lt;BR /&gt;&lt;BR /&gt;( sourcetype="firstsourcetype" "Carrier Failure: provider_name=*" ) OR&lt;BR /&gt;( sourcetype="supervisor" host="prod-celery-gateway-0*" "driver dispatch_request: Sending request to" NOT failed )&lt;BR /&gt;| stats count(eval(LIKE(sourcetype,"firstsourcetype"))) as total_carrier_errors, count(eval(LIKE(sourcetype,"supervisor"))) as total_requests&lt;BR /&gt;| eval carrier_errors_percent=(total_carrier_errors/total_requests*100)&lt;BR /&gt;| table total_carrier_errors total_requests&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 22:25:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Subquery/m-p/525922#M148430</guid>
      <dc:creator>kennetkline</dc:creator>
      <dc:date>2020-10-21T22:25:56Z</dc:date>
    </item>
  </channel>
</rss>

