<?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: multiple subsearch issue in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444540#M126068</link>
    <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar earliest=-1w latest=now
| eval Last30Min=case(_time&amp;gt;=relative_time(now(),"-30m"),1,0)
| eval Previous30Min=case(_time&amp;lt;relative_time(now(),"-30m") AND _time&amp;gt;=relative_time(now(),"-60m"),1,0)
| eval Last1Day=case(_time&amp;gt;=relative_time(now(),"-1d"),1,0)
| eval Last1Week=case(_time&amp;gt;=relative_time(now(),"-1w"),1,0)
| stats sum(Last*) as Last* sum(Previous*) as Previous*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jun 2019 13:50:50 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-06-28T13:50:50Z</dc:date>
    <item>
      <title>multiple subsearch issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444538#M126066</link>
      <description>&lt;P&gt;HI ,&lt;BR /&gt;
I have an urgent issue please help&lt;BR /&gt;
I want to generate a scheduled alert at every 30 minutes, which will have the following :-&lt;BR /&gt;
Count of logs ingested in current 30 minutes, Count of logs ingested  in previous 30 minutes , count of logs in a day, count of logs in a week&lt;BR /&gt;
how can i proceed with the same.&lt;BR /&gt;
Kindly help .&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 11:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444538#M126066</guid>
      <dc:creator>ajitshukla61116</dc:creator>
      <dc:date>2019-06-28T11:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: multiple subsearch issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444539#M126067</link>
      <description>&lt;P&gt;Hi ajitshukla61116,&lt;BR /&gt;
let me understand:&lt;BR /&gt;
all the described counts must be in the same search?&lt;BR /&gt;
why you don't create an alert for each search?&lt;BR /&gt;
then, there a relation between searches? e.g. Count of logs ingested in current 30 minutes and Count of logs ingested in previous 30 minutes must be related or are two divided results?&lt;BR /&gt;
What's your alert condition?&lt;BR /&gt;
maybe for this reason it's better to have different alerts.&lt;/P&gt;

&lt;P&gt;Anyway, if you can create a search for each result it's easy and I think that you don't know any help (If I'm wrong tell me!).&lt;/P&gt;

&lt;P&gt;If instead you want to have all the results in a search you could create something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index earliest=-30m latest=now
| stats count
| eval Time_Period="Current 30 minutes"
| append [ search
     index=my_index earliest=-60m latest=-30m
    | stats count
    | eval Time_Period="Previous 30 minutes"
    | fields count Time_Period
    ]
| append [ search
     index=my_index earliest=-d latest=now
    | stats count
    | eval Time_Period="Last Day"
    | fields count Time_Period
    ]
| append [ search
     index=my_index earliest=-w latest=now
    | stats count
    | eval Time_Period="Last Week"
    | fields count Time_Period
    ]
| table Time_Period count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 12:50:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444539#M126067</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-06-28T12:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: multiple subsearch issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444540#M126068</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar earliest=-1w latest=now
| eval Last30Min=case(_time&amp;gt;=relative_time(now(),"-30m"),1,0)
| eval Previous30Min=case(_time&amp;lt;relative_time(now(),"-30m") AND _time&amp;gt;=relative_time(now(),"-60m"),1,0)
| eval Last1Day=case(_time&amp;gt;=relative_time(now(),"-1d"),1,0)
| eval Last1Week=case(_time&amp;gt;=relative_time(now(),"-1w"),1,0)
| stats sum(Last*) as Last* sum(Previous*) as Previous*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jun 2019 13:50:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444540#M126068</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-06-28T13:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: multiple subsearch issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444541#M126069</link>
      <description>&lt;P&gt;Hi gcusello ,&lt;BR /&gt;
 Thanks for the reply .&lt;BR /&gt;
  I have configured a search in a similar manner as yours using subsearches and append but i think this search format is taking a longer time or so. due to which my searches are getting skipped and an error of&lt;BR /&gt;
"The maximum number of concurrent running jobs for this historical scheduled search on this instance has been reached", concurrency_category="historical_scheduled" is coming.&lt;BR /&gt;
 how should i go with it??&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:08:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444541#M126069</guid>
      <dc:creator>ajitshukla61116</dc:creator>
      <dc:date>2020-09-30T01:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: multiple subsearch issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444542#M126070</link>
      <description>&lt;P&gt;Hi somesoni,&lt;BR /&gt;
the above search is giving an error as -&amp;gt;"Error in 'eval' command: The arguments to the 'case' function are invalid."&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2019 07:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444542#M126070</guid>
      <dc:creator>ajitshukla61116</dc:creator>
      <dc:date>2019-06-29T07:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: multiple subsearch issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444543#M126071</link>
      <description>&lt;P&gt;Hi ajitshukla61116,&lt;BR /&gt;
one could easily imagine that the search took a long time due to the large time range, as far as the "concurrent running jobs" are concerned, it means that your search is very structured.&lt;/P&gt;

&lt;P&gt;The solution in my opinion should be structured using summary indexes: that is, you should schedule a search every 30 minutes and store the result in a Summary Index (with the collect command) and then for your alert to use the summary index with a search that, to this point, will be very simple and fast.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2019 11:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444543#M126071</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-06-29T11:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: multiple subsearch issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444544#M126072</link>
      <description>&lt;P&gt;This would probably best be done as part of a &lt;CODE&gt;summary index&lt;/CODE&gt; but you can get reasonable performance like this:&lt;/P&gt;

&lt;P&gt;I have an urgent issue please help&lt;BR /&gt;
I want to generate a scheduled alert at every 30 minutes, which will have the following :-&lt;BR /&gt;
Count of logs ingested in current 30 minutes, Count of logs ingested in previous 30 minutes , count of logs in a day, count of logs in a week&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count WHERE index=* OR index=_* earliest=-7d BY _time span=30m
| multireport
[ where _time &amp;gt;= relative_time(now(), "-30m")
| stats sum(count) AS countLast30minutes ]
[ where _time &amp;gt;= relative_time(now(), "-60m") AND _time &amp;lt;= relative_time(now(), "-30m")
| stats sum(count) AS countPrev30minutes ]
[ where _time &amp;gt;= relative_time(now(), "@d")
| stats sum(count) AS countLast30minutes ]
[ stats sum(count) AS countLast7days ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jul 2019 18:26:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-subsearch-issue/m-p/444544#M126072</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-05T18:26:27Z</dc:date>
    </item>
  </channel>
</rss>

