<?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 Query for alert in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591010#M205756</link>
    <description>&lt;P&gt;I can't figure out where and how I should set the alert only to detect results specifically 7am-8pm in the trigger alert Time Range or should it be included in the query&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Mar 2022 03:29:53 GMT</pubDate>
    <dc:creator>jakeoftrades</dc:creator>
    <dc:date>2022-03-28T03:29:53Z</dc:date>
    <item>
      <title>How to write this Splunk Query for alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/590372#M205547</link>
      <description>&lt;P&gt;hi,&lt;BR /&gt;&lt;BR /&gt;Can someone help to correct the query provided below which will send alert if&amp;nbsp;detected a STOPPED status for 3 consecutive times within a specific time range like for ex. from 7am-8pm.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="hcg_ph_t2_bigdataservices_prod" sourcetype="be:streaming-services"
| search kafka_count="STOPPED"
| stats count by _time,sourcetype,STOPPED
| sort count desc
| eval threshold=3
| where count &amp;gt;=threshold&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 22:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/590372#M205547</guid>
      <dc:creator>jakeoftrades</dc:creator>
      <dc:date>2022-03-23T22:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/590376#M205548</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244192"&gt;@jakeoftrades&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="hcg_ph_t2_bigdataservices_prod" sourcetype="be:streaming-services" kafka_count="STOPPED" 
| stats count
| where count&amp;gt;=3&lt;/LI-CODE&gt;&lt;P&gt;if you have results in this search youcan trigger the alert (triggering conditions in alert results&amp;gt;0).&lt;/P&gt;&lt;P&gt;You don't need to put a search condition after the main search: it's better to put all the conditions ad left as possible.&lt;/P&gt;&lt;P&gt;then you don't need the other conditions in the stats command.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 09:56:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/590376#M205548</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-03-23T09:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/590377#M205549</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244192"&gt;@jakeoftrades&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this&amp;nbsp; first your search alone would not trigger alert you need to save the search as alert and configure the schedule and alert conditions and setup the desired notifications of your choice&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index="hcg_ph_t2_bigdataservices_prod" sourcetype="be:streaming-services"&amp;nbsp;kafka_count="STOPPED"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|bin _time span=1h | stats count by kafka_count&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;save this search for alert &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;schedule it for every hour in the alert and setup the trigger condition search count &amp;gt;=3&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 09:57:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/590377#M205549</guid>
      <dc:creator>venky1544</dc:creator>
      <dc:date>2022-03-23T09:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591004#M205752</link>
      <description>&lt;P&gt;thanks it's showing the stat I needed to set alert&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 01:03:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591004#M205752</guid>
      <dc:creator>jakeoftrades</dc:creator>
      <dc:date>2022-03-28T01:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591005#M205753</link>
      <description>&lt;P&gt;Thank you.. It shows the specific status that is STOPPED with it's count.&lt;BR /&gt;&lt;BR /&gt;By that then I can set the alert only to trigger for that status only between 7am-8pm ?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 01:07:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591005#M205753</guid>
      <dc:creator>jakeoftrades</dc:creator>
      <dc:date>2022-03-28T01:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591010#M205756</link>
      <description>&lt;P&gt;I can't figure out where and how I should set the alert only to detect results specifically 7am-8pm in the trigger alert Time Range or should it be included in the query&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 03:29:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591010#M205756</guid>
      <dc:creator>jakeoftrades</dc:creator>
      <dc:date>2022-03-28T03:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591019#M205762</link>
      <description>&lt;P&gt;Use time range as earliest=-1h@h &amp;amp; latest=@h&lt;/P&gt;&lt;P&gt;And cron for the alert as&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2 8-20 * * *&lt;/LI-CODE&gt;&lt;P&gt;- cron basically means your alert will run 8:02 to 20:02 (8:02 PM) for the last 1 hour of time.&lt;/P&gt;&lt;P&gt;- You can run it at the 0th minute but it's good to run it 1 or 2 minute past the hour. So I'm running at the 2nd minute of every hour.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 05:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591019#M205762</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-03-28T05:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591042#M205769</link>
      <description>&lt;P&gt;Is this right .I did this:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jakeoftrades_1-1648454173744.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18793i05D25330755A27A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jakeoftrades_1-1648454173744.png" alt="jakeoftrades_1-1648454173744.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jakeoftrades_0-1648453920759.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18792iA40CB1670CF3BAA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jakeoftrades_0-1648453920759.png" alt="jakeoftrades_0-1648453920759.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 07:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591042#M205769</guid>
      <dc:creator>jakeoftrades</dc:creator>
      <dc:date>2022-03-28T07:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591069#M205777</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244192"&gt;@jakeoftrades&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you have two choices:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;put a limit in the time period of your search as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/93915"&gt;@VatsalJagani&lt;/a&gt;&amp;nbsp;hinted,&lt;/LI&gt;&lt;LI&gt;add an additional filter to your main search, al the following.&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;index="hcg_ph_t2_bigdataservices_prod" sourcetype="be:streaming-services" kafka_count="STOPPED" (date_hour&amp;gt;7 date_hour&amp;lt;21)
| stats count
| where count&amp;gt;=3&lt;/LI-CODE&gt;&lt;P&gt;if you haven't date_hour field, you have to extract it using an eval command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="hcg_ph_t2_bigdataservices_prod" sourcetype="be:streaming-services" kafka_count="STOPPED" 
| eval date_hour=strftime(_time,"%H")
| where date_hour&amp;gt;7 AND date_hour&amp;lt;21
| stats count
| where count&amp;gt;=3&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 11:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591069#M205777</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-03-28T11:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591083#M205782</link>
      <description>&lt;P&gt;yes, that looks alright.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 12:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591083#M205782</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-03-28T12:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591119#M205800</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/93915"&gt;@VatsalJagani&lt;/a&gt;&amp;nbsp; I appreciate it !&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 17:09:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/591119#M205800</guid>
      <dc:creator>jakeoftrades</dc:creator>
      <dc:date>2022-03-28T17:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query for alert</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/596650#M207692</link>
      <description>&lt;P&gt;I think I should have change the number of results which&amp;nbsp; is = 3 instead of 0 by the condition that it will only send alert.. it has been sending alert even without result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 02:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-this-Splunk-Query-for-alert/m-p/596650#M207692</guid>
      <dc:creator>jakeoftrades</dc:creator>
      <dc:date>2022-05-06T02:31:29Z</dc:date>
    </item>
  </channel>
</rss>

