<?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: Subsearch doesn't return anything in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577312#M201192</link>
    <description>&lt;P&gt;Firstly, try rephrasing your search to not use subsearch at all. (Eventstats with eval, perhaps?) Subsearches are good sometimes (that's why they are there) but have limits and can be tricky.&lt;/P&gt;&lt;P&gt;But if you really want a subsearch, yours prepares an aggregate by ID but returns only the first value. Are you sure that's what you want?&lt;/P&gt;</description>
    <pubDate>Sat, 04 Dec 2021 06:45:35 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-12-04T06:45:35Z</dc:date>
    <item>
      <title>Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577302#M201191</link>
      <description>&lt;P&gt;I'm trying to write a search that will return a table where all average values of the field price grouped by Ids are lower then 1 month ago. This is my attempt:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;index="myindex" sourcetype="mysourcetype" earliest=-1mon@mon latest=@mon | stats avg(Price) as avg by ID | where avg &amp;gt; [search index="myindex" sourcetype="mysourcetype" earliest=@d | stats avg(Price) as new_avg by ID | return $new_avg] | table *&lt;/LI-CODE&gt;&lt;P&gt;This, however, always returns 0 results even though there are events in these time periods. I even tried subtituting the subsearched with a fixed number and that produces a table. Does anyone now why this isn't working and maybe how to fix it?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 02:07:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577302#M201191</guid>
      <dc:creator>MidnightRun</dc:creator>
      <dc:date>2021-12-04T02:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577312#M201192</link>
      <description>&lt;P&gt;Firstly, try rephrasing your search to not use subsearch at all. (Eventstats with eval, perhaps?) Subsearches are good sometimes (that's why they are there) but have limits and can be tricky.&lt;/P&gt;&lt;P&gt;But if you really want a subsearch, yours prepares an aggregate by ID but returns only the first value. Are you sure that's what you want?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 06:45:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577312#M201192</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-12-04T06:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577323#M201197</link>
      <description>&lt;P&gt;I would like to use a subsearch yes, and returning the first value isn't what I want, any Idea how to fix it?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 09:56:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577323#M201197</guid>
      <dc:creator>MidnightRun</dc:creator>
      <dc:date>2021-12-04T09:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577324#M201198</link>
      <description>&lt;P&gt;Well, it ain't that easy. Subsearch returns either a "table" of results or values only but as a whole "result". You can't easily compare single field value to a set of values. (your "| where " condition). Why do you want to use the subsearch?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 12:51:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577324#M201198</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-12-04T12:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577325#M201199</link>
      <description>&lt;P&gt;I don't see any other way of doing it but with subsearch. I need to compare average values from one timerange to average values of another time frame.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 12:59:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577325#M201199</guid>
      <dc:creator>MidnightRun</dc:creator>
      <dc:date>2021-12-04T12:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577328#M201200</link>
      <description>&lt;P&gt;There are a couple of ways (and perhaps more) to do that.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="myindex" sourcetype="mysourcetype" earliest=-1mon@mon latest=@mon 
```Get the old average price```
| stats avg(Price) as avg by ID
```Get the new average price ```
| append [ search index="myindex" sourcetype="mysourcetype" earliest=@d 
  | stats avg(Price) as new_avg by ID ]
```Regroup the results```
| stats values(*) as * by ID
| where avg &amp;gt; new_avg
| table *&lt;/LI-CODE&gt;&lt;P&gt;Or, if Price is an indexed field:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats avg(Price) as avg where index="myindex" sourcetype="mysourcetype" earliest=-1mon@mon latest=@mon by ID
| tstats append=t avg(Price) as new_avg where index="myindex" sourcetype="mysourcetype" earliest=@d by ID
| where avg &amp;gt; new_avg 
| table *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 13:18:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577328#M201200</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-12-04T13:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577329#M201201</link>
      <description>&lt;P&gt;This works, thank you very much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 13:24:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577329#M201201</guid>
      <dc:creator>MidnightRun</dc:creator>
      <dc:date>2021-12-04T13:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch doesn't return anything</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577336#M201207</link>
      <description>&lt;P&gt;If your problem is resolved, then please click the "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 17:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-doesn-t-return-anything/m-p/577336#M201207</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-12-04T17:49:37Z</dc:date>
    </item>
  </channel>
</rss>

